#include "CS_SantaFireballBladeTrail.h"

CS_SantaFireballBladeTrail::CS_SantaFireballBladeTrail()
{
	type = 3;
	//³õÊ¼¶¯»­ÉèÖÃ
	ani.png = L"CS_CaveStoryMod";
	ani.sprite_index = L"am_fireball_trail";
	drawBeforeOtherEntity = true;
}

void CS_SantaFireballBladeTrail::Step()
{
	if (++ani_wait > 1)
	{
		ani_wait = 0;
		if (++ani_no > 2)
		{
			hide = true;
			Destroy();
		}
	}
	y += vy;
	ani.image_index = 3 * direct + ani_no;
	if (level == 2)
	{
		if (ani.image_index <= 8)
			ani.image_index = 8;
	}
}

void SetCS_SantaFireballBladeTrail(std::shared_ptr<Entity> parent, float x, float y, int direct, float vy, int level)
{
	auto e = std::make_shared<CS_SantaFireballBladeTrail>();
	e->x = x;
	e->y = y;
	e->direct = direct;
	e->vy = vy;
	e->ani.image_index = 3 * direct;
	e->level = level;
	parent->gameFunc->SetEntity(parent, e);
}
