#include "SysTriggerV_Player1.h"

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

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

std::shared_ptr<Entity> CreateSysTriggerV_Player1()
{
	return std::make_shared<SysTriggerV_Player1>();
}
