private void Update() { if (AllowCharacterControll) { horizontal = gamepadInput.GetJoystickAxis(GamepadJoystick.LeftJoystickHorizontal); if (gamepadInput.IsDown(GamepadButton.ButtonX)) { jump = true; } //if (gamepadInput.IsDown(GamepadButton.ButtonB)) //{ // crouch = true; //} //else if (gamepadInput.IsUp(GamepadButton.ButtonB)) //{ // crouch = false; //} direction.Set(gamepadInput.GetJoystickAxis(GamepadJoystick.RightJoystickHorizontal), gamepadInput.GetJoystickAxis(GamepadJoystick.RightJoystickVertical), 0); if (gamepadInput.IsDown(GamepadButton.RBumper)) { if (IsThrowPowerFromButtonHold) { StartGatheringPower(); } else { power = throwForce; throwObject = true; } } if (gamepadInput.IsPressed(GamepadButton.RBumper)) { if (IsThrowPowerFromButtonHold) { ContinueGatheringPower(); } } if (gamepadInput.IsUp(GamepadButton.RBumper)) { throwObject = true; } } }
// Update is called once per frame private void Update() { if (!_characterSelected && _gamepadInput != null) { float axis = _gamepadInput.GetJoystickAxis(GamepadJoystick.LeftJoystickHorizontal); if (axis == 0) { _changed = false; } else if (!_changed && axis > 0.5f) { _playerCharacter.SelectNextSkin(); _audioSource.PlayOneShot(audioClipChangeCharacter, 0.25f); _changed = true; } else if (!_changed && axis < -0.5f) { _playerCharacter.SelectPreviousSkin(); _audioSource.PlayOneShot(audioClipChangeCharacter, 0.25f); _changed = true; } } }