#include "SysTriggerH_Player2.h"

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

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

std::shared_ptr<Entity> CreateSysTriggerH_Player2()
{
	return std::make_shared<SysTriggerH_Player2>();
}
