#include "PeLifeRecoverShape.h"

PeLifeRecoverShape::PeLifeRecoverShape()
{
	type = 3;
	//设置动画
	ani.png = L"pe_effect_obj";
	ani.sprite_index = L"life_recover";
	ani.image_index = Random(0, 1);
	//随机存在时间
	action_timecounter = action_timecounter_max = Random(60, 90);
	//设置上升速度
	vy = -100 / ts;
}

void PeLifeRecoverShape::Step()
{
	if (action_timecounter > 0)
	{
		action_timecounter--;
		if (action_timecounter == 0)
			Destroy();
	}
	float alpha = min(1.0f, (float)action_timecounter / ((float)action_timecounter_max / 2.0f));
	color = RGBA(0xff, 0xff, 0xff, (BYTE)(0xff * alpha));
	//执行运动
	Entity::Step();
}
