IEnumerator <WaitCommand> OnExit() { _closeListener.Dispose(); yield return(WaitCommand.WaitRoutine(CameraTransitions.FadeOut(_data.CameraManager.Rig.ScreenFader, _data.Clock, _data.FaderSettings))); _data.CourseEditor.enabled = false; }
private IEnumerator <WaitCommand> ExitOldState() { _isTransitioning = true; while (_stack.Count > 0) { var state = _stack.Pop(); UnsubscribeToStateMethods(state); yield return(WaitCommand.WaitRoutine(InvokeStateLifeCycleMethod(state.OnExit))); } _isTransitioning = false; }
IEnumerator <WaitCommand> OnExit() { yield return(WaitCommand.WaitRoutine(CameraTransitions.FadeOut(_data.CameraManager.Rig.ScreenFader, _data.MenuClock, _data.FaderSettings))); _playingStateMachine.Transition(PlayingStates.Initial); yield return(_data.PlayerPilotSpawner.Despawn().AsWaitCommand()); _data.ChallengeAnnouncerUi.enabled = false; _data.JoystickActivator.enabled = true; _data.ThirdPersonCameraController.enabled = false; }
IEnumerator <WaitCommand> OnExit() { OnSuspend(); yield return(WaitCommand.WaitRoutine(CameraTransitions.FadeOut(_data.CameraManager.Rig.ScreenFader, _data.MenuClock, _data.FaderSettings))); _data.CameraAnimator.enabled = false; var spawnpointBillboards = _uiState.To(s => s.SpawnpointUIList).To(s => s.Items).Get(); for (int i = 0; i < spawnpointBillboards.Count; i++) { spawnpointBillboards[i].SetActive(false); } }
// When exiting always transition to spawnpoint selection // Allow options menu to be enabled IEnumerator <WaitCommand> OnEnter() { _data.CourseEditor.enabled = true; var currentCameraTransform = _data.CameraManager.Rig.transform.MakeImmutable(); _data.Mount.transform.Set(currentCameraTransform); _data.CameraManager.SwitchMount(_data.Mount); yield return(WaitCommand.WaitRoutine(CameraTransitions.FadeIn(_data.CameraManager.Rig.ScreenFader, _data.Clock, _data.FaderSettings))); _closeListener = _data.CourseEditor.CloseEditor.Subscribe(_ => { Machine.Transition(VoloStateMachine.States.SpawnScreen); }); }
IEnumerator <WaitCommand> OnEnter() { _data.CameraManager.SwitchMount(_data.CameraMount.GetComponent <ICameraMount>()); var spawnpointBillboards = _uiState.To(s => s.SpawnpointUIList).To(s => s.Items).Get(); for (int i = 0; i < _spawnpoints.Count; i++) { var spawnpoint = _spawnpoints[i]; spawnpointBillboards[i].SetActive(spawnpoint.IsDiscovered); } OnResume(); yield return(WaitCommand.WaitRoutine(CameraTransitions.FadeIn(_data.CameraManager.Rig.ScreenFader, _data.MenuClock, _data.FaderSettings))); }
IEnumerator <WaitCommand> OnEnter(SpawnpointLocation spawnpoint) { _data.ChallengeAnnouncerUi.enabled = true; _data.JoystickActivator.enabled = false; _data.ThirdPersonCameraController.enabled = true; // TODO Don't spawn the player this is now the responsisiblity of the wingsuit state //yield return _data.PlayerPilotSpawner.Respawn(spawnpoint).AsWaitCommand(); var environment = new PlayingEnvironment( spawnpoint: spawnpoint, pilot: null, parachuteConfig: _activeParachuteConfig.Get()); _playingStateMachine.Transition(PlayingStates.FlyingWingsuit, environment, Maybe.Just(new RespawnRequest())); yield return(WaitCommand.WaitRoutine(CameraTransitions.FadeIn(_data.CameraManager.Rig.ScreenFader, _data.MenuClock, _data.FaderSettings))); }
private IEnumerator <WaitCommand> InvokeStateLifeCycleMethod(Delegate del, params object[] args) { WaitCommand waitCommand = WaitCommand.DontWait; if (del != null) { try { if (del.Method.ReturnType == typeof(IEnumerator <WaitCommand>)) { waitCommand = WaitCommand.WaitRoutine((IEnumerator <WaitCommand>)del.DynamicInvoke(args)); } else { del.DynamicInvoke(args); } } catch (TargetParameterCountException e) { throw new ArgumentException(GetArgumentExceptionDetails((State)del.Target, del, args), e); } } yield return(waitCommand); }
private IEnumerator <WaitCommand> Transition(StateInstance newState, object[] enterParams) { yield return(WaitCommand.WaitRoutine(ExitOldState())); yield return(WaitCommand.WaitRoutine(EnterNewState(newState, enterParams))); }