示例#1
0
        public void StartMove(Vector2d destination)
        {
            DoPathfind       = true;
            hasPath          = false;
            straightPath     = false;
            this.Destination = destination;
            IsMoving         = true;
            StoppedTime      = 0;
            Arrived          = false;

            //For now, use old next-best-node system when size requires consideration
            viableDestination = this.GridSize <= 1 ?
                                Pathfinder.GetEndNode(Agent.Body.Position, destination, out destinationNode) :
                                Pathfinder.GetClosestViableNode(Agent.Body.Position, destination, this.GridSize, out destinationNode);
            //TODO: If next-best-node, autostop more easily
            //Also implement stopping sooner based on distance

            StuckTime   = 0;
            RepathTries = 0;
            IsCasting   = true;
            if (onStartMove != null)
            {
                onStartMove();
            }
        }
示例#2
0
        public void StartMove(Vector2d destination)
        {
            DoPathfind = true;
            Agent.SetState(AnimState.Moving);
            hasPath          = false;
            straightPath     = false;
            this.Destination = destination;
            IsMoving         = true;
            StoppedTime      = 0;
            Arrived          = false;

            viableDestination = Pathfinder.GetClosestViableNode(Agent.Body.Position, destination, this.GridSize, out destinationNode);

            StuckTime   = 0;
            RepathTries = 0;
            IsCasting   = true;
            if (onStartMove != null)
            {
                onStartMove();
            }
        }