private void EvaluateKey() { switch (inputState) { case InputState.Pressed: if (InputManager.GetKeyDown(keyCode)) { onAction.Invoke(); } break; case InputState.Released: if (InputManager.GetKeyUp(keyCode)) { onAction.Invoke(); } break; case InputState.Held: if (InputManager.GetKey(keyCode)) { onAction.Invoke(); } break; } }
private void UpdateInputDevice() { bool anyJoystickKey = false; if (_inputDevice == InputDevice.Joystick) { if (InputManager.anyKey) { for (int i = 0; i <= 19; i++) { if (InputManager.GetKey((KeyCode)(_firstJoystickKey + i))) { anyJoystickKey = true; break; } } if (!anyJoystickKey) { SetInputDevice(InputDevice.KeyboardAndMouse); } } else { if (InputManager.AnyInput(_keyboardConfiguration)) { SetInputDevice(InputDevice.KeyboardAndMouse); } } } else { if (InputManager.anyKey) { for (int i = 0; i <= 19; i++) { if (InputManager.GetKey((KeyCode)(_firstJoystickKey + i))) { anyJoystickKey = true; break; } } if (anyJoystickKey) { SetInputDevice(InputDevice.Joystick); } } else { if (InputManager.AnyInput(_joystickConfiguration)) { SetInputDevice(InputDevice.Joystick); } } } }