public bool ShouldOpen() { if (!Open && KeyHelper.CheckTap(Keys.Escape)) { PopUpRect = new Rectangle((int)RenderHandler.ScreenOffset.X + ((int)Game.ScreenSize.X / 2) - (SizeX / 2), (int)RenderHandler.ScreenOffset.Y + ((int)Game.ScreenSize.Y / 2) - (SizeY / 2), SizeX, SizeY); menuItems.Clear(); //Exit Button menuItems.Add(new MenuItem(new Rectangle(PopUpRect.X, PopUpRect.Bottom, PopUpRect.Width, 50), Game.GameContent.Load <Texture2D>(PlayerManager.movingPlayerSprite), "Exit") { Action = () => { RenderHandler.CurrentGameState = GAMESTATE.MAINMENU; GameSaveHandler.CreateSave(((PlayerManager)Game.PlayerCharacter.Manager).CurrentSave); MenuHandler.ActiveFullScreenMenu = new GameStartMenu(); Open = false; } }); Open = true; return(true); } return(false); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (ShouldClose) { Exit(); } KeyHelper.Update(); RenderHandler.Update(); MouseHandler.Update(); if (KeyHelper.CheckTap(Keys.OemTilde)) { DialogueHandler.Start(TestHelper.GetTestDialogues()); } if (KeyHelper.CheckTap(Keys.D3)) { ((PlayerManager)PlayerCharacter.Manager).Inventory.AddToInventory(new Flight()); } if (KeyHelper.CheckTap(Keys.D2)) { ((PlayerManager)PlayerCharacter.Manager).Inventory.AddToInventory(new RegularHealingPotion()); } if (KeyHelper.CheckTap(Keys.D1)) { ((PlayerManager)PlayerCharacter.Manager).Inventory.AddToInventory(new RegularSpeedPotion()); } if (KeyHelper.CheckHeld(Keys.D0)) { PlayerManager.Health--; } GameTimeMilliseconds = gameTime.ElapsedGameTime.TotalMilliseconds; GameTimeSeconds = gameTime.ElapsedGameTime.TotalSeconds; base.Update(gameTime); }
public static void Update() { ActiveDialogue.Update(); if (KeyHelper.CheckTap(Keys.Enter)) { if (DialogueIndex < Dialogues.Length - 1) { if (!ActiveDialogue.IsCompleted()) { ActiveDialogue.QuickComplete(); } else { ActiveDialogue = Dialogues[++DialogueIndex]; } } else { RenderHandler.CurrentGameState = GAMESTATE.ACTIVE; ActiveDialogue = null; Dialogues = new Dialogue[] { }; DialogueIndex = 0; } } }
public bool ShouldClose() { if (Open && KeyHelper.CheckTap(Keys.Escape)) { Open = false; return(true); } return(false); }
public void CheckKeys() { if (South) { InAir = false; } if (RenderHandler.CurrentGameState == GAMESTATE.ACTIVE) { if (KeyHelper.CheckHeld(Keys.A)) { velocity.X -= velocity.X > -terminalVelocity.X ? moveSpeed : 0; if (!InAir) { animate.Switch(PlayerManager.movingPlayerSprite, SpriteRectangle); } if (!Game.PlayerManager.EquippedWeapon.Sprite.Visible) { animate.Flipped = true; } } if (KeyHelper.CheckHeld(Keys.D)) { velocity.X += velocity.X < terminalVelocity.X ? moveSpeed : 0; if (!InAir) { animate.Switch(PlayerManager.movingPlayerSprite, SpriteRectangle); } if (!Game.PlayerManager.EquippedWeapon.Sprite.Visible) { animate.Flipped = false; } } if (KeyHelper.CheckTap(Keys.Space)) { if (!InAir) { InAir = true; velocity.Y -= terminalVelocity.Y; animate.Switch(TextureHelper.Sprites.SmileyWalk, SpriteRectangle, 4, 4); } } //if (newState.IsKeyDown(Keys.S)) { } if (KeyHelper.CheckTap(Keys.Q)) { ((PlayerManager)Manager).EquippedWeapon?.OnQAbility(); } if (KeyHelper.CheckTap(Keys.E)) { ((PlayerManager)Manager).Class.EAction(); } } if ((velocity.X > -1 && velocity.X < 1) && !InAir) { animate.Switch(PlayerManager.basePlayerSpriteName, SpriteRectangle, 1, 1); } }
public bool ShouldOpen() { if (MenuHandler.ActivePopUp != this) { Open = false; } if (KeyHelper.CheckTap(Keys.I) && !Open) { LoadItems(); Open = true; return(true); } return(false); }
public bool ShouldClose() { if (KeyHelper.CheckTap(Keys.I) && Open) { Open = false; foreach (Item i in Items) { i.Sprite.Visible = false; if (i is Weapon) { i.Sprite.ItemRectangle.Width = (int)((Weapon)i).Size.X; i.Sprite.ItemRectangle.Height = (int)((Weapon)i).Size.Y; } } return(true); } return(false); }