#include "CS_PeRebirthFountain.h"
#include "CS_PeRebirthWaterDrop.h"
CS_PeRebirthFountain::CS_PeRebirthFountain()
{
	type = 3;
}

void CS_PeRebirthFountain::Step()
{
	if (lr == 0)
	{
		if (++ani_wait > 1)
		{
			ani_wait = 0;
			++ani_no;
		}
		if (ani_no > 1)
		{
			ani_no = 0;
			return;
		}
		if (++act_no % 2)
		{
			auto e = std::make_shared<CS_PeRebirthWaterDrop>();
			e->x = x;
			e->y = y;
			e->vx = 2 * Random(-0x200, 0x200) / ts;
			e->vy = 3 * Random(-0x200, 0x80) / ts;
			gameFunc->SetEntity(shared_from_this(), e);
		}
		auto e = std::make_shared<CS_PeRebirthWaterDrop>();
		e->x = x;
		e->y = y;
		e->vx = 2 * Random(-0x200, 0x200) / ts;
		e->vy = 3 * Random(-0x200, 0x80) / ts;
		gameFunc->SetEntity(shared_from_this(), e);
	}
}

std::shared_ptr<Entity> CreateCS_PeRebirthFountain()
{
	return std::make_shared<CS_PeRebirthFountain>();
}
