public bool GetButton(int playerID)
        {
            bool value = false;

            if (m_type == InputType.KeyButton)
            {
                value = Input.GetKey(m_positive);
            }
            else if (m_type == InputType.GamepadButton)
            {
                value = GamepadHandler.GetButton(m_gamepadButton, playerID);
            }
            else if (m_type == InputType.GamepadAnalogButton)
            {
                value = axesAsButtonValues[playerID] == ButtonState.Pressed || axesAsButtonValues[playerID] == ButtonState.JustPressed;
            }
            else if (m_type == InputType.DigitalAxis)
            {
                value = Input.GetKey(useNegativeAxisForButton ? m_negative : m_positive);
            }
            else if (m_type == InputType.GamepadAxis)
            {
                value = axesAsButtonValues[playerID] == ButtonState.Pressed || axesAsButtonValues[playerID] == ButtonState.JustPressed;
            }
            else if (m_type == InputType.MouseAxis)
            {
                value = axesAsButtonValues[playerID] == ButtonState.Pressed || axesAsButtonValues[playerID] == ButtonState.JustPressed;
            }
            return(value);
        }
示例#2
0
        public bool AnyInput(int playerID)
        {
            switch (m_type)
            {
            case InputType.KeyButton:
                return(Input.GetKey(m_positive));

            case InputType.GamepadAnalogButton:
                return(axesAsButtonValues[playerID] == ButtonState.Pressed || axesAsButtonValues[playerID] == ButtonState.JustPressed);

            case InputType.GamepadButton:
                return(GamepadHandler.GetButton(m_gamepadButton, playerID));

            case InputType.GamepadAxis:
                return(GamepadHandler.GetAxisRaw(m_gamepadAxis, playerID, m_deadZone) != 0f);

            case InputType.DigitalAxis:
                return(digitalAxisValue != 0);

            case InputType.MouseAxis:
                return(Input.GetAxisRaw(rawMouseAxisName) != 0);

            default:
                return(false);
            }
        }