// called only once public override void Execute(EventQueue p_eventQueue) { if (SourceEntity.MarkedForDestruction) { Completed = true; return; } float l_costToMove = _ActionPoint.Calculations.actionPointBetweenNavigationNodes(SourceEntity.CurrentNavigationNode, TargetNavigationNode); ActionPoint l_actionPoint = EntityComponent.get_component <ActionPoint>(SourceEntity); MovementAllowed = (l_actionPoint.ActionPointData.CurrentActionPoints >= l_costToMove && NavigationGraphAlgorithm.areNavigationNodesNeighbors(NavigationGraphContainer.UniqueNavigationGraph, SourceEntity.CurrentNavigationNode, TargetNavigationNode, NavigationGraphFlag.CURRENT)); if (MovementAllowed) { LocomotionSystemV2.HeadTowardsNode(EntityComponent.get_component <Locomotion>(SourceEntity).LocomotionSystemV2, TargetNavigationNode, (p_startNavigationNode, p_endNavigationNode) => { ActionPoint.add(l_actionPoint, -1 * l_costToMove); Completed = true; }); } else { Completed = true; } }
public override void Execute(EventQueue p_eventQueue) { LocomotionSystemV2.warp(EntityComponent.get_component <Locomotion>(Entity).LocomotionSystemV2, TargetNavigationNode); EventQueue.insertEventAt(p_eventQueue, 0, EntityCurrentNavigationNodeChange.alloc(Entity, TargetNavigationNode)); }