// Evaluate the current value of each axis input and call the delegates
        private void EvaluateAxisInput(PlayerIndex currentIndex, GamePadState state)
        {
            // Process input for trigger buttons
            #region Right Trigger

            OnRightTriggerPressed?.Invoke(currentIndex, state.Triggers.Right);

            #endregion

            #region Left Trigger

            OnLeftTriggerPressed?.Invoke(currentIndex, state.Triggers.Left);

            #endregion

            // Process input for axiis
            #region Joystick Right

            Vector2 axisValue = new Vector2(state.ThumbSticks.Right.X, state.ThumbSticks.Right.Y);
            OnRightJoystickMove?.Invoke(currentIndex, axisValue);

            #endregion

            #region Joystick Left

            axisValue = new Vector2(state.ThumbSticks.Left.X, state.ThumbSticks.Left.Y);
            OnLeftJoystickMove?.Invoke(currentIndex, axisValue);

            #endregion

            #region DPAD

            axisValue = Vector2.zero;
            if (state.DPad.Left == ButtonState.Pressed)
            {
                axisValue.x = -1;
            }

            if (state.DPad.Right == ButtonState.Pressed)
            {
                axisValue.x = 1;
            }

            if (state.DPad.Up == ButtonState.Pressed)
            {
                axisValue.y = 1;
            }

            if (state.DPad.Down == ButtonState.Pressed)
            {
                axisValue.y = -1;
            }

            OnDpadMove?.Invoke(currentIndex, axisValue);

            #endregion
        }
Exemplo n.º 2
0
        private void NotifyRightTriggerPressed()
        {
            OnRightTriggerPressed?.Invoke();

            SayToLog("Right Trigger pressed.");
        }