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; }
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); } }
/// <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); }
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); }
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); } }
/// <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); }
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; } }
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; }
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> public void MoveAlong(Path path, ReplanCallback onReplan) { _movable.MoveAlong(path, onReplan); }
public void MoveAlong(Path path, ReplanCallback onReplan) { ThrowException(); }
private void StopInternal() { lock (_syncLock) { _stopped = true; _wayPoints.Clear(); _currentPath = null; _pendingPathRequest = null; _currentDestination = null; _pendingResult = null; _manualReplan = null; } }
public void MoveAlong(Path path, ReplanCallback onReplan) { _currentPath = path; }
/// <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);
/// <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); }