private async Task <bool> InteractingWithDeathGate() { if (await _interactionCoroutine.GetCoroutine()) { if (_interactionCoroutine.State == InteractionCoroutine.States.TimedOut) { Logger.Debug("[Bounty] Near death gate, but interaction timed out."); State = States.Failed; _interactionCoroutine = null; } else { _deathGate = null; _deathGateIgnoreList = new List <int>(); State = States.Moving; _interactionCoroutine = null; } } return(false); }
private async Task<bool> InteractingWithDeathGate() { if (await _interactionCoroutine.GetCoroutine()) { if (_interactionCoroutine.State == InteractionCoroutine.States.TimedOut) { Logger.Debug("[Bounty] Near death gate, but interaction timed out."); State = States.Failed; _interactionCoroutine = null; } else { _deathGate = null; _deathGateIgnoreList = new List<int>(); State = States.Moving; _interactionCoroutine = null; } } return false; }
private async Task<bool> MovingToDeathGate() { if (_deathGate != null && _deathGate.IsFullyValid()) { if (AdvDia.MyPosition.Distance(_deathGate.Position) <= 7f) { Navigator.PlayerMover.MoveStop(); MoveResult = MoveResult.ReachedDestination; } else { _deathGate = ActorFinder.FindNearestDeathGate(_deathGateIgnoreList); if (_deathGate == null) { MoveResult = MoveResult.Failed; State = States.Failed; return false; } MoveResult = await CommonCoroutines.MoveTo(_deathGate.Position); } switch (MoveResult) { case MoveResult.ReachedDestination: var distance = AdvDia.MyPosition.Distance(_deathGate.Position); if (distance <= 7f) { _interactionCoroutine = new InteractionCoroutine(_deathGate.ActorSNO, new TimeSpan(0, 0, 1), new TimeSpan(0, 0, 3)); State = States.InteractingWithDeathGate; } else { _deathGateIgnoreList.Add(_deathGate.ACDGuid); State = States.Moving; } break; case MoveResult.Failed: case MoveResult.PathGenerationFailed: State = States.Failed; break; case MoveResult.PathGenerated: break; case MoveResult.UnstuckAttempt: if (_unstuckAttemps > 1) { State = States.Failed; return false; } _unstuckAttemps++; Logger.Debug("[Navigation] Unstuck attempt #{0}", _unstuckAttemps); break; case MoveResult.Moved: case MoveResult.PathGenerating: break; } return false; } State = States.Failed; return false; }
private async Task <bool> MovingToDeathGate() { if (_deathGate != null && _deathGate.IsFullyValid()) { if (AdvDia.MyPosition.Distance(_deathGate.Position) <= 7f) { Navigator.PlayerMover.MoveStop(); MoveResult = MoveResult.ReachedDestination; } else { _deathGate = ActorFinder.FindNearestDeathGate(_deathGateIgnoreList); if (_deathGate == null) { MoveResult = MoveResult.Failed; State = States.Failed; return(false); } MoveResult = await CommonCoroutines.MoveTo(_deathGate.Position); } switch (MoveResult) { case MoveResult.ReachedDestination: var distance = AdvDia.MyPosition.Distance(_deathGate.Position); if (distance <= 7f) { _interactionCoroutine = new InteractionCoroutine(_deathGate.ActorSnoId, new TimeSpan(0, 0, 1), new TimeSpan(0, 0, 3)); State = States.InteractingWithDeathGate; } else { _deathGateIgnoreList.Add(_deathGate.ACDId); State = States.Moving; } break; case MoveResult.Failed: case MoveResult.PathGenerationFailed: State = States.Failed; break; case MoveResult.PathGenerated: break; case MoveResult.UnstuckAttempt: if (_unstuckAttemps > 1) { State = States.Failed; return(false); } _unstuckAttemps++; Logger.Debug("[Navigation] Unstuck attempt #{0}", _unstuckAttemps); break; case MoveResult.Moved: case MoveResult.PathGenerating: break; } return(false); } State = States.Failed; return(false); }