#include "CS_SantaAir.h"
const int CS_SantaSTATENAME_AIR = ++entityStateID;
CS_SantaAir::CS_SantaAir()
{
	stateID = CS_SantaSTATENAME_AIR;
}

void CS_SantaAir::SetAir(int index)
{
	auto we = e.lock();
	if (!we)
		return;

	//ÉèÖÃ¶¯»­
	const wchar_t* jump = L"";
	if (we->ud == -1)
		jump = we->lr == 0 ? L"mc_santa_jump_lu" : L"mc_santa_jump_ru";
	else if (we->ud == 0)
		jump = we->lr == 0 ? L"mc_santa_jump_l" : L"mc_santa_jump_r";
	else if (we->ud == 1)
		jump = we->lr == 0 ? L"mc_santa_jump_ld" : L"mc_santa_jump_rd";
	we->ani.sprite_index = jump;
	we->ani.image_index = index;
}

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

	if (we->vy < 0)
		SetAir(0);
	else
		SetAir(1);
}

void CS_SantaAir::ChangeStateMsg(int stateID)
{
	if (stateID == GetStateID())
		enable = true;
	else
		enable = false;
}
