Exemplo n.º 1
0
 partial void CustomInitializeTopDownInput()
 {
     if (InputDevice is Keyboard keyboard)
     {
         TalkInput      = keyboard.GetKey(Microsoft.Xna.Framework.Input.Keys.Space);
         CancelInput    = keyboard.GetKey(Microsoft.Xna.Framework.Input.Keys.Escape);
         InventoryInput = keyboard.GetKey(Microsoft.Xna.Framework.Input.Keys.I);
         UpInput        = keyboard.GetKey(Microsoft.Xna.Framework.Input.Keys.Up)
                          .Or(keyboard.GetKey(Microsoft.Xna.Framework.Input.Keys.W));
         DownInput = keyboard.GetKey(Microsoft.Xna.Framework.Input.Keys.Down)
                     .Or(keyboard.GetKey(Microsoft.Xna.Framework.Input.Keys.S));
         PauseInput = keyboard.GetKey(Microsoft.Xna.Framework.Input.Keys.M)
                      .Or(keyboard.GetKey(Microsoft.Xna.Framework.Input.Keys.F1))
                      .Or(keyboard.GetKey(Microsoft.Xna.Framework.Input.Keys.Pause));
     }
     else if (InputDevice is Xbox360GamePad gamepad)
     {
         TalkInput      = gamepad.GetButton(Xbox360GamePad.Button.A);
         CancelInput    = gamepad.GetButton(Xbox360GamePad.Button.B);
         InventoryInput = gamepad.GetButton(Xbox360GamePad.Button.X);
         UpInput        = gamepad.GetButton(Xbox360GamePad.Button.DPadUp)
                          .Or(gamepad.LeftStick.UpAsButton);
         DownInput = gamepad.GetButton(Xbox360GamePad.Button.DPadDown)
                     .Or(gamepad.LeftStick.DownAsButton);
         PauseInput = gamepad.GetButton(Xbox360GamePad.Button.Start);
     }
 }
        public InputButton_XBoxController(Xbox360GamePad parentDevice, /*PlayerIndex xnaPlayerIndex,*/ int buttonNumber)
        {
            //_XNAPlayerIndex = xnaPlayerIndex;

            _ButtonReference = parentDevice.GetButton((Xbox360GamePad.Button)buttonNumber);
            _ButtonNumber    = buttonNumber;
        }
Exemplo n.º 3
0
 public PlayerInput(Xbox360GamePad gamePad)
 {
     MovementInput = gamePad.LeftStick;
     AimingInput   = gamePad.RightStick;
     ShootingInput = gamePad.RightTrigger;
     BoostInput    = gamePad.LeftTrigger;
     Start         = gamePad.GetButton(Xbox360GamePad.Button.Start);
 }
Exemplo n.º 4
0
        /// <summary>
        /// Creates a new I2DInput from the calling IPressableInput which returns a Value of 0 if not pressed, and 1 if pressed.
        /// </summary>
        /// <param name="thisInput">The IpressableInput to use as a 1DInput</param>
        /// <returns>The resulting I1DInput.</returns>
        public static I1DInput To1DInput(this IPressableInput thisInput)
        {
            var toReturn = new DelegateBased1DInput(
                () => thisInput.IsDown ? 1 : 0,
                () => 0
                );

            return(toReturn);
        }
Exemplo n.º 5
0
        //IPressableInput jumpinput = InputManager.Keyboard.GetKey(Keys.Space);
        //IPressableInput jumpinputgamepad = InputManager.Xbox360GamePads[0].GetButton(Xbox360GamePad.Button.A);
        private void CustomInitialize()
        {
            //TODO add the konami code
            //InitializePlatformerInput(input);
            Animations();
            this.RunInput = InputManager.Keyboard.GetKey(Keys.LeftShift);

            InitializePlatformerInput(input);
        }
Exemplo n.º 6
0
 partial void CustomInitializeTopDownInput()
 {
     if (InputDevice is Xbox360GamePad gamePad)
     {
         rightStick         = gamePad.RightStick;
         swapWeaponsBack    = gamePad.GetButton(Xbox360GamePad.Button.LeftShoulder);
         swapWeaponsForward = gamePad.GetButton(Xbox360GamePad.Button.RightShoulder);
     }
     else if (InputDevice is Keyboard keyboard)
     {
         rightStick         = null; // Fixes bug when KB player joins game and GamePad is connected.
         swapWeaponsBack    = keyboard.GetKey(Microsoft.Xna.Framework.Input.Keys.Q);
         swapWeaponsForward = keyboard.GetKey(Microsoft.Xna.Framework.Input.Keys.E);
     }
 }
Exemplo n.º 7
0
        public void LoadInput(PlayerInput playerInput)
        {
            if (playerInput == null)
            {
                throw new ArgumentNullException("playerInput", "playerInput cannot be a null refernece.");
            }
            this.playerInput   = playerInput;
            this.movementInput = playerInput.MovementInput;
            this.aimingInput   = playerInput.AimingInput;
            this.shootingInput = playerInput.ShootingInput;

            if (GlobalContent.FeatureFlags[FeatureFlags.EnableBoost].IsEnabled)
            {
                this.boostInput = playerInput.BoostInput;
            }
        }
Exemplo n.º 8
0
        public PlayerInput(FlatRedBall.Input.Keyboard keyboard)
        {
            MovementInput = keyboard.Get2DInput(Microsoft.Xna.Framework.Input.Keys.A,
                                                Microsoft.Xna.Framework.Input.Keys.D,
                                                Microsoft.Xna.Framework.Input.Keys.W,
                                                Microsoft.Xna.Framework.Input.Keys.S);

            AimingInput = keyboard.Get2DInput(Microsoft.Xna.Framework.Input.Keys.Left,
                                              Microsoft.Xna.Framework.Input.Keys.Right,
                                              Microsoft.Xna.Framework.Input.Keys.Up,
                                              Microsoft.Xna.Framework.Input.Keys.Down);

            ShootingInput = keyboard.GetKey(Microsoft.Xna.Framework.Input.Keys.Space);
            BoostInput    = keyboard.GetKey(Keys.Q);
            Start         = keyboard.GetKey(Keys.Enter);
        }
Exemplo n.º 9
0
        public static MultiplePressableInputs Or(this IPressableInput thisInput, IPressableInput input)
        {
            MultiplePressableInputs toReturn;

            if (thisInput is MultiplePressableInputs)
            {
                toReturn = (MultiplePressableInputs)thisInput;
            }
            else
            {
                toReturn = new MultiplePressableInputs();
                toReturn.Inputs.Add(thisInput);
            }

            toReturn.Inputs.Add(input);

            return(toReturn);
        }
Exemplo n.º 10
0
        partial void CustomInitializeTopDownInput()
        {
            if (InputDevice is Xbox360GamePad gamePad)
            {
                shootLeftInput = gamePad.LeftTrigger
                                 .Or(gamePad.GetButton(Xbox360GamePad.Button.LeftShoulder));
                shootRightInput = gamePad.RightTrigger
                                  .Or(gamePad.GetButton(Xbox360GamePad.Button.RightShoulder));
                sailTurningInput = gamePad.RightStick.Horizontal;
                IPressableInput gas = gamePad.GetButton(Xbox360GamePad.Button.B);
                Gas = new DelegateBasedPressableInput(() => !gas.IsDown, () => gas.WasJustReleased, () => gas.WasJustPressed).To1DInput();
            }
            else if (InputDevice is Keyboard keyboard)
            {
                shootLeftInput = keyboard.GetKey(Microsoft.Xna.Framework.Input.Keys.Q)
                                 .Or(InputManager.Mouse.GetButton(Mouse.MouseButtons.LeftButton));

                shootRightInput = keyboard.GetKey(Microsoft.Xna.Framework.Input.Keys.E)
                                  .Or(InputManager.Mouse.GetButton(Mouse.MouseButtons.RightButton));
                sailTurningInput = InputManager.Keyboard.Get1DInput(Microsoft.Xna.Framework.Input.Keys.Left, Microsoft.Xna.Framework.Input.Keys.Right);
                IPressableInput gas = InputManager.Keyboard.GetKey(Microsoft.Xna.Framework.Input.Keys.Space);
                Gas = new DelegateBasedPressableInput(() => !gas.IsDown, () => gas.WasJustReleased, () => gas.WasJustPressed).To1DInput();
            }
        }
Exemplo n.º 11
0
        internal void AddKeyboardControls()
        {
            movementInput = InputManager.Keyboard.Get2DInput(Keys.A, Keys.D, Keys.W, Keys.S);

            shootInput = InputManager.Keyboard.GetKey(Keys.Space);
        }
Exemplo n.º 12
0
 private void AssignGeneralInput()
 {
     QuitGame = InputManager.Keyboard.GetKey(Keys.Escape);
 }