#include "CS_TalaComputer.h"

CS_TalaComputer::CS_TalaComputer()
{
	ani.png = L"CS_CaveStoryMod";
	ani.sprite_index = L"ls_tala_computer";
	//图层显示
	ani.hideLayerList.insert({ 0,1,2 });
	drawBeforeOtherEntity = true;
}

void CS_TalaComputer::SetState(int stateID, int lr)
{
	this->lr = lr;
	switch (stateID)
	{
	case 0://关机
		ani.hideLayerList.insert({ 0,1,2 });
		break;
	case 1://没有传送目标
		ani.hideLayerList.insert({ 1,2 });
		ani.hideLayerList.erase(0);
		break;
	case 2://已和传送目标连接
		ani.hideLayerList.insert({ 0,2 });
		ani.hideLayerList.erase(1);
		break;
	case 3://特殊功能
		ani.hideLayerList.insert({ 0,1 });
		ani.hideLayerList.erase(2);
		break;
	}
}

void CS_TalaComputer::SetState(std::wstring stateName, int lr)
{
	if (stateName == L"off")
		SetState(0, lr);
	else if(stateName == L"no_link")
		SetState(1, lr);
	else if (stateName == L"linked")
		SetState(2, lr);
	else if (stateName == L"special")
		SetState(3, lr);
}

std::shared_ptr<Entity> CreateCS_TalaComputer()
{
	return std::make_shared<CS_TalaComputer>();
}
