Exemplo n.º 1
0
void GotoAIEvent::Update(float /*dt*/)
{
	Sentient* pActor = GetActor();

	PathFinderMove move;
	GetPathfinder().FindNextMove( pActor->GetPosition(), _destination, _arrivalDist, move );

	if( move.LastResult == PathFinder::PFMR_PATH_FOUND)
	{
		pActor->ApplyImpulse( move.MoveDir * _moveSpeed * pActor->GetBody()->GetMass(), Vector2::Zero );
	}
	else if( move.LastResult == PathFinder::PFMR_ARRIVED )
	{
		_moveFailed = false;
		IssueCallback();
	}
	else if( move.LastResult == PathFinder::PFMR_PATH_NOT_FOUND )
	{
		_moveFailed = true;
		IssueCallback();
	}

}