public override void OnUpdate(float dt) { if (Mouse.current != null && Mouse.current.middleButton.wasPressedThisFrame) { CursorUtils.ToggleMouseCursor(); _controls.InputEnabled = !_controls.InputEnabled; } if (_interactions.GetCurrentGame() != null && ((Keyboard.current != null && Keyboard.current.eKey.wasPressedThisFrame) || (Gamepad.current != null && Gamepad.current.rightStickButton.wasPressedThisFrame))) { _stateController.TransitionTo <GameFocusState>(); } }
public override void OnUpdate(float dt) { if (Mouse.current != null && Mouse.current.middleButton.wasPressedThisFrame) { CursorUtils.ToggleMouseCursor(); _currentGame.InputEnabled = !_currentGame.InputEnabled; } if (!Cursor.visible) { if ((Keyboard.current != null && Keyboard.current.eKey.wasPressedThisFrame) || (Gamepad.current != null && Gamepad.current.rightStickButton.wasPressedThisFrame)) { _stateController.TransitionTo <NormalState>(); } if (Keyboard.current != null && _currentGame != null) { if (Keyboard.current.pKey.wasPressedThisFrame) { if (_currentGame.Running) { _currentGame.Pause(); } else { _currentGame.Resume(); } } if (Keyboard.current.f5Key.wasPressedThisFrame && _currentGame.SaveState(0)) { Debug.Log("State saved to slot 0"); } if (Keyboard.current.f6Key.wasPressedThisFrame && _currentGame.SaveState(1)) { Debug.Log("State saved to slot 1"); } if (Keyboard.current.f7Key.wasPressedThisFrame && _currentGame.SaveState(2)) { Debug.Log("State saved to slot 2"); } if (Keyboard.current.f8Key.wasPressedThisFrame && _currentGame.SaveState(3)) { Debug.Log("State saved to slot 3"); } if (Keyboard.current.f9Key.wasPressedThisFrame && _currentGame.LoadState(0)) { Debug.Log("State loaded from slot 0"); } if (Keyboard.current.f10Key.wasPressedThisFrame && _currentGame.LoadState(1)) { Debug.Log("State loaded from slot 1"); } if (Keyboard.current.f11Key.wasPressedThisFrame && _currentGame.LoadState(2)) { Debug.Log("State loaded from slot 2"); } if (Keyboard.current.f12Key.wasPressedThisFrame && _currentGame.LoadState(3)) { Debug.Log("State loaded from slot 3"); } _currentGame.Rewind(Keyboard.current.backspaceKey.isPressed); } } }