#include "CS_PeRebirthWaterDrop.h"

CS_PeRebirthWaterDrop::CS_PeRebirthWaterDrop()
{
	type = 3;
	ani.png = L"CS_CaveStoryMod";
	ani.sprite_index = L"pe_rebirth_particles";
	drawBeforeOtherEntity = true;
	//启用碰撞
	cbRect.enableCbRect = true;
	cbRect.enableSoild = true;
	//设置实体框
	cbRect.top = cbRect.bottom = cbRect.left = cbRect.right = 1;
}

void CS_PeRebirthWaterDrop::Step()
{
	auto& ani_no = ani.image_index;
	vy += 0x20 / ts;
	ani_no = Random(0, 4);
	if (vy > 0x5FF / ts)
		vy = 0x5FF / ts;
	//清除最后一次碰撞结果
	Entity::ClearCollisionResult();
	//执行运动
	Entity::Step();
	//执行碰撞
	Entity::Collision();
	if (++act_wait > 10)
	{
		if (cbRect.cbLeft || cbRect.cbRight || cbRect.cbBottom || cbRect.inWater)
			Destroy();
	}
}
