Esempio n. 1
0
    static public string InputToAnimatorField(EGamePadButton button)
    {
        switch (button)
        {
            case EGamePadButton.A:
                return "A";
            case EGamePadButton.B:
                return "B";
            case EGamePadButton.X:
                return "X";
            case EGamePadButton.Y:
                return "Y";
			case EGamePadButton.LeftTrigger:
				return "LeftTrigger";
			case EGamePadButton.LeftShoulder:
                return "LeftButton";
            case EGamePadButton.RightTrigger:
                return "RightTrigger";
			case EGamePadButton.RightShoulder:
				return "RightButton";
            case EGamePadButton.None:
                return "None";
			default:
                return "";
        }
    }
Esempio n. 2
0
 private void BuildGamePadEvent(GamePadState state, EGamePadButton button, ref GamePadEventArgs e)
 {
     e.State                = state;
     e.Button               = button;
     e.Vectors.LeftStick    = new Vector2(state.ThumbSticks.Left.X, state.ThumbSticks.Left.Y);
     e.Vectors.RightStick   = new Vector2(state.ThumbSticks.Right.X, state.ThumbSticks.Right.Y);
     e.Vectors.LeftTrigger  = state.Triggers.Left;
     e.Vectors.RightTrigger = state.Triggers.Right;
 }
    void AssignButton(EGamePadButton button)
    {
        try
        {
            switch (button) // Check enum value and assign the correct input function.
            {
            case EGamePadButton.A:
                m_buttons.Add(button, APressed);
                break;

            case EGamePadButton.B:
                m_buttons.Add(button, BPressed);
                break;

            case EGamePadButton.X:
                m_buttons.Add(button, XPressed);
                break;

            case EGamePadButton.Y:
                m_buttons.Add(button, YPressed);
                break;

            case EGamePadButton.UP:
                m_buttons.Add(button, DPadUpPressed);
                break;

            case EGamePadButton.DOWN:
                m_buttons.Add(button, DPadDownPressed);
                break;

            case EGamePadButton.LEFT:
                m_buttons.Add(button, DPadLeftPressed);
                break;

            case EGamePadButton.RIGHT:
                m_buttons.Add(button, DPadRightPressed);
                break;

            case EGamePadButton.LEFT_BUMPER:
                m_buttons.Add(button, LeftBumperPressed);
                break;

            case EGamePadButton.RIGHT_BUMPER:
                m_buttons.Add(button, RightBumperPressed);
                break;
            }
        }
        catch (ArgumentException e) // If there are duplicate bindings are found an argument exception will be thrown.
        {
            if (e.GetType() == typeof(ArgumentException))
            {
                //Always logging, fix me
                //Debug.Log("PlayerInput.cs: Multiple inputs detected with the same binding.");
            }
        }
    }
Esempio n. 4
0
        private ButtonState GetVectorState(EGamePadButton button, GamePadState state)
        {
            ButtonState ret  = ButtonState.Released;
            bool        down = false;
            float       t    = ClickThreshold;

            switch (button)
            {
            case EGamePadButton.LeftStickLeft:
                down = state.ThumbSticks.Left.X < -t;
                break;

            case EGamePadButton.LeftStickRight:
                down = state.ThumbSticks.Left.X > t;
                break;

            case EGamePadButton.LeftStickUp:
                down = state.ThumbSticks.Left.Y > t;
                break;

            case EGamePadButton.LeftStickDown:
                down = state.ThumbSticks.Left.Y < -t;
                break;

            case EGamePadButton.RightStickLeft:
                down = state.ThumbSticks.Right.X < -t;
                break;

            case EGamePadButton.RightStickRight:
                down = state.ThumbSticks.Right.X > t;
                break;

            case EGamePadButton.RightStickUp:
                down = state.ThumbSticks.Right.Y > t;
                break;

            case EGamePadButton.RightStickDown:
                down = state.ThumbSticks.Right.Y < -t;
                break;

            case EGamePadButton.LeftTrigger:
                down = state.Triggers.Left > t;
                break;

            case EGamePadButton.RightTrigger:
                down = state.Triggers.Right > t;
                break;
            }

            ret = down ? ButtonState.Pressed : ButtonState.Released;

            return(ret);
        }
Esempio n. 5
0
			public InputGamePadButton(EGamePadButton button) {
				Button = button;
			}
Esempio n. 6
0
		private void BuildGamePadEvent(GamePadState state, EGamePadButton button, ref GamePadEventArgs e) {
			e.State = state;
			e.Button = button;
			e.Vectors.LeftStick = new Vector2(state.ThumbSticks.Left.X, state.ThumbSticks.Left.Y);
			e.Vectors.RightStick = new Vector2(state.ThumbSticks.Right.X, state.ThumbSticks.Right.Y);
			e.Vectors.LeftTrigger = state.Triggers.Left;
			e.Vectors.RightTrigger = state.Triggers.Right;
		}
Esempio n. 7
0
		private ButtonState GetVectorState(EGamePadButton button, GamePadState state) {
			ButtonState ret = ButtonState.Released;
			bool down = false;
			float t = ClickThreshold;

			switch (button) {
				case EGamePadButton.LeftStickLeft:
					down = state.ThumbSticks.Left.X < -t;
					break;
				case EGamePadButton.LeftStickRight:
					down = state.ThumbSticks.Left.X > t;
					break;
				case EGamePadButton.LeftStickUp:
					down = state.ThumbSticks.Left.Y > t;
					break;
				case EGamePadButton.LeftStickDown:
					down = state.ThumbSticks.Left.Y < -t;
					break;

				case EGamePadButton.RightStickLeft:
					down = state.ThumbSticks.Right.X < -t;
					break;
				case EGamePadButton.RightStickRight:
					down = state.ThumbSticks.Right.X > t;
					break;
				case EGamePadButton.RightStickUp:
					down = state.ThumbSticks.Right.Y > t;
					break;
				case EGamePadButton.RightStickDown:
					down = state.ThumbSticks.Right.Y < -t;
					break;

				case EGamePadButton.LeftTrigger:
					down = state.Triggers.Left > t;
					break;
				case EGamePadButton.RightTrigger:
					down = state.Triggers.Right > t;
					break;
			}

			ret = down ? ButtonState.Pressed : ButtonState.Released;

			return ret;
		}
Esempio n. 8
0
		public GamePadEventArgs(PlayerIndex playerIndex, EGamePadButton button) {
			PlayerIndex = playerIndex;
			Button = button;
		}
Esempio n. 9
0
 public GamePadEventArgs(PlayerIndex playerIndex, EGamePadButton button)
 {
     PlayerIndex = playerIndex;
     Button      = button;
 }
Esempio n. 10
0
 public InputGamePadButton(EGamePadButton button)
 {
     Button = button;
 }