private async Task TickAsync(UpdateContext context, CancellationToken cancellationToken) { if (_activePhase == null) { // Start with the spinning phase _activePhase = _spinningPhase; await _activePhase.StartAsync(); _phaseTimer.Reset(); } _phaseTimer.Update(_gameTime); if (_phaseTimer.HasElapsed) { // Stop the active phase await _activePhase.StopAsync(); // Swap phases if (ReferenceEquals(_activePhase, _spinningPhase)) { _activePhase = _shootingPhase; } else { _activePhase = _spinningPhase; } // Start the next phase await _activePhase.StartAsync(); _phaseTimer.Reset(); } // Tick the active phase await _activePhase.TickAsync(_gameTime); }