#include "SysTriggerV_Player2.h"

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

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

std::shared_ptr<Entity> CreateSysTriggerV_Player2()
{
	return std::make_shared<SysTriggerV_Player2>();
}
