private void SetManualPath(Path path, ReplanCallback onReplan)
        {
            if (path == null || path.count == 0)
            {
                StopInternal();
                return;
            }

            _stop         = false;
            _stopped      = false;
            _arrivalEvent = UnitNavigationEventMessage.Event.DestinationReached;
            _manualReplan = onReplan;

            int pathCount = path.count - 1;

            for (int i = 0; i < pathCount; i++)
            {
                var node = path[i];
                if (node is Waypoint)
                {
                    _wayPoints.AddWaypoint(node.position);
                }
            }

            _wayPoints.AddWaypoint(path.Last().position, true);

            SetPath(path, false);

            _lastPathRequestTime = Time.time;
        }
Esempio n. 2
0
 protected override void MoveAlongInternal(Path path, ReplanCallback onReplan)
 {
     for (int i = 0; i < this.count; i++)
     {
         var clone = path.Clone();
         this[i].MoveAlong(clone, onReplan);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Asks the object to move along the specified path.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="onReplan">The callback to call when replanning is needed.</param>
        public void MoveAlong(Path path, ReplanCallback onReplan)
        {
            Ensure.ArgumentNotNull(path, "path");

            StopInternal();

            SetManualPath(path, onReplan);
        }
Esempio n. 4
0
 private void StopInternal()
 {
     _stopped = true;
     _wayPoints.Clear();
     _currentPath        = null;
     _pendingPathRequest = null;
     _pendingResult      = null;
     _manualReplan       = null;
 }
        /// <summary>
        /// Asks the object to move along the specified path.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="onReplan">The callback to call when replanning is needed.</param>
        public void MoveAlong(Path path, ReplanCallback onReplan)
        {
            Ensure.ArgumentNotNull(path, "path");

            StopInternal();

            _lastNavigationEvent = UnitNavigationEventMessage.Event.None;
            SetManualPath(path, onReplan);
        }
Esempio n. 6
0
        public static void MoveAlong <T>(this IGrouping <T> grouping, Path path, ReplanCallback onReplan) where T : IGroupable <T>
        {
            var groupCount = grouping.groupCount;

            for (int i = 0; i < groupCount; i++)
            {
                grouping[i].MoveAlong(path, onReplan);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Asks the object to move along the specified path.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="onReplan">The callback to call when replanning is needed.</param>
        protected override void MoveAlongInternal(Path path, ReplanCallback onReplan)
        {
            if (_blockMoveOrders)
            {
                // if move orders are blocked, then stop here
                return;
            }

            Ensure.ArgumentNotNull(path, "path");
            StopInternal();
            SetManualPath(path, onReplan);
        }
Esempio n. 8
0
 private void StopInternal()
 {
     lock (_syncLock)
     {
         _onFinalApproach = false;
         _stopped         = true;
         _wayPoints.Clear();
         _pathboundWayPoints.Clear();
         _currentPath        = null;
         _pendingPathRequest = null;
         _currentDestination = null;
         _pendingResult      = null;
         _manualReplan       = null;
     }
 }
        private void StopInternal()
        {
            lock (_syncLock)
            {
                if (_pendingPathRequest != null)
                {
                    _pendingPathRequest.hasDecayed = true;
                }

                _stopped = true;
                _wayPoints.Clear();
                _currentPath        = null;
                _pendingPathRequest = null;
                _currentDestination = null;
                _pendingResult      = null;
                _manualReplan       = null;
            }
        }
Esempio n. 10
0
        private void SetManualPath(Path path, ReplanCallback onReplan)
        {
            if (path == null || path.count == 0)
            {
                StopInternal();
                return;
            }

            _stop               = false;
            _stopped            = false;
            _onFinalApproach    = false;
            _manualReplan       = onReplan;
            _currentPath        = path;
            _endOfResolvedPath  = _currentPath.Last().position;
            _currentDestination = path.Pop();
            _currentGrid        = GridManager.instance.GetGrid(_currentDestination.position);

            _endOfPath           = _endOfResolvedPath;
            _lastPathRequestTime = Time.time;
        }
Esempio n. 11
0
        private void SetManualPath(Path path, ReplanCallback onReplan)
        {
            if (this.count == 0 || _modelUnit == null)
            {
                // if the group has no members, then no need to set anything
                return;
            }

            if (path == null || path.count == 0)
            {
                StopInternal();
                return;
            }

            _manualReplan        = onReplan;
            _currentPath         = path;
            _lastPathRequestTime = Time.time;

            SetVectorFieldPath();
        }
Esempio n. 12
0
        private void SetManualPath(Path path, ReplanCallback onReplan)
        {
            if (path == null || path.count == 0)
            {
                StopInternal();
                return;
            }

            _stop = false;
            _stopped = false;
            _onFinalApproach = false;
            _manualReplan = onReplan;
            _currentPath = path;
            _endOfResolvedPath = _currentPath.Last().position;
            _currentDestination = path.Pop();
            _currentGrid = GridManager.instance.GetGrid(_currentDestination.position);

            _endOfPath = _endOfResolvedPath;
            _lastPathRequestTime = Time.time;
        }
 /// <summary>
 /// Asks the object to move along the specified path.
 /// </summary>
 /// <param name="path">The path.</param>
 /// <param name="onReplan">The callback to call when replanning is needed.</param>
 public void MoveAlong(Path path, ReplanCallback onReplan)
 {
     _movable.MoveAlong(path, onReplan);
 }
 public void MoveAlong(Path path, ReplanCallback onReplan)
 {
     ThrowException();
 }
        private void SetManualPath(Path path, ReplanCallback onReplan)
        {
            if (this.count == 0 || _modelUnit == null)
            {
                // if the group has no members, then no need to set anything
                return;
            }

            if (path == null || path.count == 0)
            {
                StopInternal();
                return;
            }

            _manualReplan = onReplan;
            _currentPath = path;
            _lastPathRequestTime = Time.time;

            SetVectorFieldPath();
        }
        /// <summary>
        /// Asks the object to move along the specified path.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="onReplan">The callback to call when replanning is needed.</param>
        protected override void MoveAlongInternal(Path path, ReplanCallback onReplan)
        {
            if (_blockMoveOrders)
            {
                // if move orders are blocked, then stop here
                return;
            }

            Ensure.ArgumentNotNull(path, "path");
            StopInternal();
            SetManualPath(path, onReplan);
        }
Esempio n. 17
0
 private void StopInternal()
 {
     lock (_syncLock)
     {
         _stopped = true;
         _wayPoints.Clear();
         _currentPath = null;
         _pendingPathRequest = null;
         _currentDestination = null;
         _pendingResult = null;
         _manualReplan = null;
     }
 }
Esempio n. 18
0
 public void MoveAlong(Path path, ReplanCallback onReplan)
 {
     _currentPath = path;
 }
Esempio n. 19
0
        /// <summary>
        /// Asks the object to move along the specified path.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="onReplan">The callback to call when replanning is needed.</param>
        public void MoveAlong(Path path, ReplanCallback onReplan)
        {
            Ensure.ArgumentNotNull(path, "path");

            StopInternal();

            SetManualPath(path, onReplan);
        }
Esempio n. 20
0
        private void SetManualPath(Path path, ReplanCallback onReplan)
        {
            if (path == null || path.count == 0)
            {
                StopInternal();
                return;
            }

            _stop = false;
            _stopped = false;
            _arrivalEvent = UnitNavigationEventMessage.Event.DestinationReached;
            _manualReplan = onReplan;

            int pathCount = path.count - 1;
            for (int i = 0; i < pathCount; i++)
            {
                var node = path[i];
                if (node is Waypoint)
                {
                    _wayPoints.AddWaypoint(node.position);
                }
            }

            _wayPoints.AddWaypoint(path.Last().position, true);

            SetPath(path, false);

            _lastPathRequestTime = Time.time;
        }
Esempio n. 21
0
 /// <summary>
 /// Internal implementation of <see cref="MoveAlongInternal"/>
 /// </summary>
 /// <param name="path">The path.</param>
 /// <param name="onReplan">The callback to call when replanning is needed.</param>
 protected abstract void MoveAlongInternal(Path path, ReplanCallback onReplan);
Esempio n. 22
0
 /// <summary>
 /// Asks the object to move along the specified path.
 /// </summary>
 /// <param name="path">The path.</param>
 /// <param name="onReplan">The callback to call when replanning is needed.</param>
 public void MoveAlong(Path path, ReplanCallback onReplan)
 {
     PrepareForAction();
     MoveAlongInternal(path, onReplan);
 }
Esempio n. 23
0
 /// <summary>
 /// Asks the object to move along the specified path.
 /// </summary>
 /// <param name="path">The path.</param>
 /// <param name="onReplan">The callback to call when replanning is needed.</param>
 public void MoveAlong(Path path, ReplanCallback onReplan)
 {
     _movable.MoveAlong(path, onReplan);
 }
Esempio n. 24
0
 public void MoveAlong(Path path, ReplanCallback onReplan)
 {
     _currentPath = path;
 }
Esempio n. 25
0
 public void MoveAlong(Path path, ReplanCallback onReplan)
 {
     ThrowException();
 }