public override void Update(GameTime gameTime, IKeyboardMouse input, IMazeinteraction mazeGame) { KeyboardState keys = input.GameKeys; KeyboardState oldKeys = input.OldKeys; MouseState mouse = input.GameMouse; MouseState oldMouse = input.OldMouse; if (keys.IsKeyDown(Keys.Left)) { MoveLeft(); NoDirection('y'); } else if (keys.IsKeyDown(Keys.Right)) { MoveRight(); NoDirection('y'); } else if (keys.IsKeyDown(Keys.Up)) { MoveUp(); NoDirection('x'); } else if (keys.IsKeyDown(Keys.Down)) { MoveDown(); NoDirection('x'); } else NoDirection('a'); CheckForCollisions(mazeGame); }
public static BaseObject GetMouseOnClick( IKeyboardMouse input) { BaseObject mouseRect = null; if (input.GameMouse.LeftButton == ButtonState.Pressed && input.OldMouse.LeftButton == ButtonState.Released) mouseRect = new BaseObject(string.Empty, new Microsoft.Xna.Framework.Rectangle( input.GameMouse.X, input.GameMouse.Y, 1, 1)); return mouseRect; }
public virtual void Update(GameTime gametime, IKeyboardMouse input) { }
public override void Update(GameTime gametime, IKeyboardMouse input) { CheckForButtonHover(input.GameMouse); CheckForButtonClicks(input.GameMouse, input.OldMouse); }
private ICollidable GetMouseRect(IKeyboardMouse input) { ICollidable mouseRect = null; if (input.GameMouse.LeftButton == ButtonState.Pressed && input.OldMouse.LeftButton == ButtonState.Released) mouseRect = new BaseObject(string.Empty, new Rectangle(input.GameMouse.X, input.GameMouse.Y, 1, 1)); return mouseRect; }
public override void Update(GameTime gametime, IKeyboardMouse input) { ICollidable mouseRect = GetMouseRect(input); if (mouseRect != null) { Button b = CheckForMenuButtonClicks(mouseRect); if (b == null) { b = CheckForNavButtonClicks(mouseRect); if (b != null) { RemoveSelectedItemFromTextButtonList(); b.PerformClickedActions(); PositionAnBind(); } } else b.PerformClickedActions(); } base.Update(gametime, input); }
private void CheckForPause(IKeyboardMouse input) { KeyboardState keys = input.GameKeys; KeyboardState oldKeys = input.OldKeys; if (keys.IsKeyDown(Keys.P) && oldKeys.IsKeyUp(Keys.P)) this.Gamestate = GameState.Paused; pauseMenu = (BasicMenu)CreatePauseMenu(); }
public override void UpDate(GameTime gameTime, IKeyboardMouse input) { UpDateTimeKeeper(gameTime.ElapsedGameTime, TotalGameTime); CheckForPause(input); switch (this.Gamestate) { case GameState.Loading: break; case GameState.Playing: UpDateCompetionTime(gameTime.ElapsedGameTime); camera.UpdDate(gameTime); UpDateBorders(); UpdateWalls(); CreateItems(); entity.Update(gameTime, input, this); if (CheckForWin()) EndGame(); break; case GameState.Paused: if (examineMap) mapExamMenu.Update(gameTime, input); else pauseMenu.Update(gameTime, input); break; case GameState.GameOver: gameOverMenu.Update(gameTime, input); break; } }
public void Update(GameTime gametime, IKeyboardMouse input) { if (activeMenu != null) activeMenu.Update(gametime, input); }