public void UpdateInput(InputManager input) { if (input.Keyboard.IsKeyHeld(Keys.A) || input.Keyboard.IsKeyHeld(Keys.Left) || input.GamePad.IsButtonHeld(PlayerIndex.One, Buttons.LeftThumbstickLeft) || input.GamePad.IsButtonHeld(PlayerIndex.One, Buttons.DPadLeft)) { Position += new Vector2(-Speed, 0f); } if (input.Keyboard.IsKeyHeld(Keys.D) || input.Keyboard.IsKeyHeld(Keys.Right) || input.GamePad.IsButtonHeld(PlayerIndex.One, Buttons.LeftThumbstickRight) || input.GamePad.IsButtonHeld(PlayerIndex.One, Buttons.DPadRight)) { Position += new Vector2(Speed, 0f); } if (input.Keyboard.IsKeyHeld(Keys.Space) || input.GamePad.IsButtonHeld(PlayerIndex.One, Buttons.A) || input.GamePad.IsButtonHeld(PlayerIndex.One, Buttons.RightTrigger)) { if (_bulletShotElapsed >= FiringRate) { FireWeapons?.Invoke(this); _bulletShotElapsed = 0; } } var viewport = Engine.Instance.Graphics.GraphicsDevice.Viewport; if (Position.X < 0) { Position = new Vector2(0f, Position.Y); } if (Position.X + Size.X > viewport.Width) { Position = new Vector2(viewport.Width - Size.X, Position.Y); } }
public virtual void UpdateInput(InputManager input) { throw new System.NotImplementedException(); }
public override void UpdateInput(InputManager input) { // No input required // Debug settings //if (input.Keyboard.IsKeyHeld(Keys.Right)) Value++; //if (input.Keyboard.IsKeyHeld(Keys.Left)) Value--; }
public override void UpdateInput(InputManager input) { State = ButtonState.Normal; if (input.Mouse.Bounds.Intersects(Bounds)) { State = ButtonState.Hover; if (input.Mouse.IsButtonPressed(MouseButtons.Left) || input.Mouse.IsButtonHeld(MouseButtons.Left)) { State = ButtonState.Click; } if (input.Mouse.IsButtonPressed(MouseButtons.Left)) OnClick?.Invoke(this); } }
public override void UpdateInput(InputManager input) { }
public override void UpdateInput(InputManager input) { if (_acceptButton.IsEnabled) _acceptButton.UpdateInput(input); if (_cancelButton.IsEnabled) _cancelButton.UpdateInput(input); }
public override void UpdateInput(InputManager input) { if (input.Mouse.Bounds.Intersects(Bounds)) { if (input.Mouse.IsButtonPressed(MouseButtons.Left)) { IsSelected = true; } } }
public override void UpdateInput(InputManager input) { //Nothing to input }
public virtual void UpdateInput(InputManager input) { }