public static float?GetAngle(this I2DInput instance) { if (instance.X == 0 && instance.Y == 0) { return(null); } else { return((float)System.Math.Atan2(instance.Y, instance.X)); } }
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); } }
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; } }
public static Multiple2DInputs Or(this I2DInput thisInput, I2DInput input) { Multiple2DInputs toReturn; if (thisInput is Multiple2DInputs) { toReturn = (Multiple2DInputs)thisInput; } else { toReturn = new Multiple2DInputs(); toReturn.Inputs.Add(thisInput); } toReturn.Inputs.Add(input); return(toReturn); }
internal void AddKeyboardControls() { movementInput = InputManager.Keyboard.Get2DInput(Keys.A, Keys.D, Keys.W, Keys.S); shootInput = InputManager.Keyboard.GetKey(Keys.Space); }