#include "SysTriggerH_Player1.h"

SysTriggerH_Player1::SysTriggerH_Player1()
{
	//启用碰撞
	cbRect.enableCbRect = true;
	cbRect.enableSoild = true;
	//设置实体框
	cbRect.top = cbRect.bottom = 5;
	cbRect.left = cbRect.right = 8;
	//忽略移动平台
	cbRect.ignoreMovePlatform = true;
}

void SysTriggerH_Player1::Step()
{
	el.flag.tTouch = true;
	if (!(gameFunc && gameFunc->GetMyChar_Player1))
		return;
	auto wmychar = gameFunc->GetMyChar_Player1(gameFunc->entityRes).lock();
	if (!wmychar)
		return;
	vx = wmychar->x - x;
	//执行运动
	Entity::Step();
	//清除最后一次碰撞结果
	Entity::ClearCollisionResult();
	//执行碰撞
	Entity::Collision();
}

std::shared_ptr<Entity> CreateSysTriggerH_Player1()
{
	return std::make_shared<SysTriggerH_Player1>();
}
