private bool NotStarted() { State = States.Clearing; _currentDestination = ActorFinder.FindNearestHostileUnitInRadius(_center, _radius); if (_currentDestination == Vector3.Zero && !_forceMoveAround) { State = States.Completed; return(false); } if (_forceMoveAround) { // Desperate Measures _forceClearDestinations = new ConcurrentBag <Vector3>( ExplorationHelpers.GetFourPointsInEachDirection(_center, _radius).Where(d => d != Vector3.Zero)); Core.Logger.Debug($"[ClearArea] No actors found in the area, using the desperate measures. Center={_center} Radius={_radius}"); State = States.ForceClearing; if (_forceClearDestinations.TryTake(out _currentDestination)) { return(false); } Core.Logger.Error($"[ClearArea] Couldn't get force clear destinations, ending tag. Center={_center} Radius={_radius}"); State = States.Completed; return(true); } return(false); }
private async Task <bool> Clearing() { if (!await NavigationCoroutine.MoveTo(_currentDestination, 10)) { return(false); } _currentDestination = _currentDestination = ActorFinder.FindNearestHostileUnitInRadius(_center, _radius); if (_currentDestination == Vector3.Zero) { State = States.Cleared; } return(false); }
public static void CheckClearArea(Vector3 center, float radius) { CheckClearArea(radius, () => ActorFinder.FindNearestHostileUnitInRadius(center, radius) != Vector3.Zero); }