예제 #1
0
    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;
            }
        }
    }
예제 #2
0
        // 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;
                }
            }
        }