private async Task <bool> Checking() { var actor = ActorFinder.FindObject(_actorId); //if (actor != null && actor.Distance > actor.CollisionSphere.Radius + 2) //{ // await NavigationCoroutine.MoveTo(actor.Position, (int)actor.CollisionSphere.Radius + 1); // return false; //} if (_sourceWorldDynamicId != AdvDia.CurrentWorldDynamicId) { Logger.Debug("[UsePortal] World has changed, assuming done."); State = States.Completed; return(false); } if (actor == null) { Logger.Debug("[UsePortal] Nothing to interact, failing. "); State = States.Failed; return(false); } if (_interactAttempts > 5) { await NavigationCoroutine.MoveTo(actor.Position, (int)actor.Distance - 1); _interactAttempts = 0; } State = States.Interacting; return(false); }
//private readonly WaitTimer _newNodePickTimer = new WaitTimer(TimeSpan.FromSeconds(60)); private async Task <bool> Exploring() { if (_currentDestination == null || _currentDestination.IsVisited)// || _newNodePickTimer.IsFinished) { //_newNodePickTimer.Stop(); //_currentDestination = ExplorationHelpers.NearestWeightedUnvisitedNodeLocation(_levelAreaIds); if (_currentDestination != null) { _currentDestination.IsCurrentDestination = false; } _currentDestination = ExplorationHelpers.NearestWeightedUnvisitedNode(_levelAreaIds); if (_currentDestination != null) { _currentDestination.IsCurrentDestination = true; } //_newNodePickTimer.Reset(); } if (_currentDestination != null) { if (await NavigationCoroutine.MoveTo(_currentDestination.NavigableCenter, 3)) { _currentDestination.IsVisited = true; _currentDestination.IsCurrentDestination = false; _currentDestination = null; } return(false); } State = States.Completed; return(false); }
private async Task <bool> ForceClearing() { if (!await NavigationCoroutine.MoveTo(_currentDestination, 10)) { return(false); } if (!_forceClearDestinations.TryTake(out _currentDestination)) { State = States.Cleared; } 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); }
private async Task <bool> Cleared() { if (!_returnToCenter) { State = States.Completed; return(false); } if (!await NavigationCoroutine.MoveTo(_center, 10)) { return(false); } State = States.Completed; return(true); }