Example #1
0
        void Update()
        {
            var pilotActionMap          = _data.PilotActionMapProvider.ActionMap;
            var shouldRespawn           = pilotActionMap.PollButtonEvent(WingsuitAction.Respawn) == ButtonEvent.Down;
            var shouldSwitchVehicleType = pilotActionMap.PollButtonEvent(WingsuitAction.UnfoldParachute) ==
                                          ButtonEvent.Down;

            if (!_isRespawning)
            {
                if (_transitToParachuteEditor)
                {
                    _transitToParachuteEditor = false;
                    Machine.Transition(Playing.PlayingStates.EditingParachute, _environment);
                }
                else if (shouldRespawn)
                {
                    _data.CoroutineScheduler.Run(RespawnWithFade());
                }
                else if (shouldSwitchVehicleType)
                {
                    Machine.Transition(Playing.PlayingStates.FlyingParachute, _environment);
                }
                else if (pilotActionMap.PollButtonEvent(WingsuitAction.ChangeCamera) == ButtonEvent.Down)
                {
                    _environment = _environment.NextMount();
                    SwitchToMount(_environment.SelectedCameraMount);
                }
                else if (pilotActionMap.PollButtonEvent(WingsuitAction.ToggleSpectatorView) == ButtonEvent.Down)
                {
                    Machine.Transition(Playing.PlayingStates.Spectating);
                }
            }
        }
Example #2
0
            private void Update()
            {
                var parachuteActionMap      = _data.ParachuteActionMap.V;
                var pilotActionMap          = _data.PilotActionMapProvider.ActionMap;
                var shouldRespawn           = pilotActionMap.PollButtonEvent(WingsuitAction.Respawn) == ButtonEvent.Down;
                var shouldSwitchVehicleType = pilotActionMap.PollButtonEvent(WingsuitAction.UnfoldParachute) == ButtonEvent.Down;

                _data.GameHud.SetParachuteInput(_data.ParachuteController.Input);

                if (shouldRespawn || _isRespawnRequested)
                {
                    _isRespawnRequested = false;
                    Machine.Transition(Playing.PlayingStates.FlyingWingsuit, _environment, Maybe.Just(new RespawnRequest()));
                }
                else
                {
                    if (_transitToEditor)
                    {
                        _transitToEditor = false;
                        Machine.Transition(Playing.PlayingStates.EditingParachute, _environment);
                    }
                    else if (parachuteActionMap.ParachuteConfigToggle == ButtonEvent.Down)
                    {
                        TransitToEditingState();
                    }
                    else if (shouldSwitchVehicleType)
                    {
                        Machine.Transition(Playing.PlayingStates.FlyingWingsuit, _environment, Maybe.Nothing <RespawnRequest>());
                    }
                    else if (pilotActionMap.PollButtonEvent(WingsuitAction.ChangeCamera) == ButtonEvent.Down)
                    {
                        _environment = _environment.NextMount();
                        SwitchToMount(_environment.SelectedCameraMount);
                    }
                    else if (pilotActionMap.PollButtonEvent(WingsuitAction.ToggleSpectatorView) == ButtonEvent.Down)
                    {
                        Machine.Transition(Playing.PlayingStates.Spectating);
                    }
                }
            }