Ejemplo n.º 1
0
        // 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;
            }
        }
Ejemplo n.º 2
0
 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));
 }