#include "CS_FireworksSound.h"

CS_FireworksSound::CS_FireworksSound()
{
	shoot_counter_max = Random(240, 300);//随机发射时间间隔
	shoot_counter = Random(0, 240);
}

void CS_FireworksSound::Step()
{
	if (shoot_counter > 0)
	{
		shoot_counter--;
		if (shoot_counter == 0)
		{
			//设置烟花
			shoot_counter = shoot_counter_max;
			//设置爆炸时间
			explode_counter = Random(60, 80);
		}
	}
	if (explode_counter > 0)
	{
		explode_counter--;
		if (explode_counter == 0)
			gameFunc->PlaySound(L"CS_023_thud");
	}
}

std::shared_ptr<Entity> CreateCS_FireworksSound()
{
	return std::make_shared<CS_FireworksSound>();
}
