#include "CS_Enemy_LaserTrapSight.h"

CS_Enemy_LaserTrapSight::CS_Enemy_LaserTrapSight()
{
	cbRect.enableCbRect = true;
	cbRect.left = 1;
	cbRect.top = 1;
	cbRect.right = 0;
	cbRect.bottom = 0;
	coyote_max = 0;
}

void CS_Enemy_LaserTrapSight::Step()
{
}

void CS_Enemy_LaserTrapSight::TestDistance(float srcX, float srcY, float dirX, float dirY)
{
	x = srcX;
	y = srcY;
	vx = dirX;
	vy = dirY;
	//清除最后一次碰撞结果
	Entity::ClearCollisionResult();
	//最多循环100下
	for (int maxloop = 1000; maxloop > 0; maxloop--)
	{
		//执行运动
		x += vx * 8;
		y += vy * 8;
		//执行碰撞
		Entity::Collision();
		if (cbRect.cbTop || cbRect.cbBottom || cbRect.cbLeft || cbRect.cbRight)
			break;
	}
	vx = 0;
	vy = 0;
}
