Example #1
0
        public bool?GetButton()
        {
            bool?value = null;

            if (m_type == InputType.Button)
            {
                value = Input.GetKey(m_positive);
            }
            else if (m_type == InputType.GamepadButton)
            {
                value = GamepadState.GetButton(m_gamepadButton, m_gamepadIndex);
            }
            else if (m_type == InputType.RemoteButton)
            {
                value = m_remoteButtonState == ButtonState.Pressed || m_remoteButtonState == ButtonState.JustPressed;
            }
            else if (m_type == InputType.AnalogButton || m_type == InputType.GamepadAnalogButton)
            {
                value = m_analogButtonState == ButtonState.Pressed || m_analogButtonState == ButtonState.JustPressed;
            }

            if (value.HasValue && !value.Value)
            {
                value = null;
            }

            return(value);
        }
Example #2
0
        public bool?GetButton()
        {
            bool?value = null;

            if (m_type == InputType.Button)
            {
                //Ryan's comment
                //If we change m_positive to Positive the Get/Set will be called in update
                value = Input.GetKey(Positive);
            }
            else if (m_type == InputType.GamepadButton)
            {
                value = GamepadState.GetButton(m_gamepadButton, m_gamepadIndex);
            }
            else if (m_type == InputType.RemoteButton)
            {
                value = m_remoteButtonState == ButtonState.Pressed || m_remoteButtonState == ButtonState.JustPressed;
            }
            else if (m_type == InputType.AnalogButton || m_type == InputType.GamepadAnalogButton)
            {
                value = m_analogButtonState == ButtonState.Pressed || m_analogButtonState == ButtonState.JustPressed;
            }

            if (value.HasValue && !value.Value)
            {
                value = null;
            }

            return(value);
        }