#include "CS_KanpaHurt.h"
#include "CS_Kanpa.h"
const int CS_KanpaSTATENAME_HURT = GetNextEntityStateID();
CS_KanpaHurt::CS_KanpaHurt()
{
	stateID = CS_KanpaSTATENAME_HURT;
}

void CS_KanpaHurt::State()
{
	auto we = e.lock();
	if (!we)
		return;

	auto mychar = std::static_pointer_cast<CS_Kanpa>(we);
	we->ani.sprite_index = we->lr == 0 ? L"mc_kanpa_hurt_l" : L"mc_kanpa_hurt_r";
}

void CS_KanpaHurt::ChangeStateMsg(int stateID)
{
	if (stateID == GetStateID())
	{
		auto we = e.lock();
		if (!we)
			return;

		auto mychar = std::static_pointer_cast<CS_Kanpa>(we);
		enable = true;
		mychar->action_timecounter = 30;
	}
	else
		enable = false;
}
