private void StartFight(Character character, Models.Game game) { var currentFight = CreateCurrentFight(character, game); FightAuth.SetCurrentFight(currentFight); StaticBooleans.SetHasFightBeenInitializedBool(false); }
public void Update(ContentManager Content, GameTime gameTime) { if (StaticBooleans.IsShopOpen) { shopScreen.Update(); } else if (FightAuth.HasStartedFight()) { fightScreen.Update(gameTime, Content); } else { foreach (CharacterBlock cb in characters) { if (StaticBooleans.NeedInitializing) { cb.Initialize(); cb.LoadContent(Content); } } StaticBooleans.SetNeedInitializingBool(false); foreach (CharacterBlock cb in characters) { cb.Update(); } foreach (Button button in buttons) { button.Update(); } } }
private void NewGame() { Models.Game currentGame = CreateNewGame(); AddCharactersToGame(currentGame); GameAuth.SetCurrentGame(currentGame); StaticBooleans.SetHasNewGame(true); StaticBooleans.SetIsGameMenuInitializedBool(false); }
public void Update() { prevKeyState = keyState; keyState = Keyboard.GetState(); if (keyState.IsKeyDown(Keys.Escape) && prevKeyState.IsKeyUp(Keys.Escape)) { StaticBooleans.SetHasNewGame(true); StaticBooleans.SetNeedInitializingBool(true); FightAuth.EndFight(); } }
public void Draw(SpriteBatch spriteBatch, ContentManager Content) { if (StaticBooleans.IsShopOpen) { shopScreen.Draw(spriteBatch); } else if (FightAuth.HasStartedFight()) { if (!StaticBooleans.HasFightBeenInitialized) { fightScreen.Initialize(); fightScreen.LoadContent(Content); StaticBooleans.SetHasFightBeenInitializedBool(true); } fightScreen.Draw(spriteBatch); } else { LoadGameMenu(spriteBatch); } }
public void Update(ContentManager Content, GameTime gameTime) { if (!StaticBooleans.IsShopOpen) { foreach (Button button in buttons) { button.Update(); } } if (StaticBooleans.IsLoadGamesOn && StaticBooleans.HasNewGame) { loadGameScreen.Initialize(); loadGameScreen.LoadContent(Content); StaticBooleans.SetHasNewGame(false); } if (StaticBooleans.IsLoadGamesOn && !StaticBooleans.IsShopOpen) { loadGameScreen.Update(); } if (StaticBooleans.IsStatGamesOn) { loadStatGameScreen.Initialize(); loadStatGameScreen.LoadContent(Content); StaticBooleans.SetHasNewGame(false); } if (StaticBooleans.IsStatGamesOn && !StaticBooleans.IsShopOpen) { loadStatGameScreen.Update(); } if (GameAuth.HasStartedGame() && !StaticBooleans.IsGameMenuInitialized) { gameMenu.Initialize(); gameMenu.LoadContent(Content); StaticBooleans.SetIsGameMenuInitializedBool(true); } if (GameAuth.HasStartedGame()) { gameMenu.Update(Content, gameTime); } }
public void Update() { prevMouseState = MouseState; MouseState = Mouse.GetState(); if (MouseState.X < pos.X || MouseState.Y < pos.Y || MouseState.X > pos.X + font.MeasureString(name).X || MouseState.Y > pos.Y + font.MeasureString(name).Y) { //The mouse is not hovering over the button color = new Color(255, 255, 255); if (StaticBooleans.IsShopOpen) { if (item != null && this.item.Price > GameAuth.GetCurrentGame().Money) { color = new Color(161, 161, 161); } else if (item != null && BagOver4(GameAuth.GetCurrentGame())) { color = new Color(161, 161, 161); } } } else { color = new Color(161, 161, 161); if (MouseState.LeftButton == ButtonState.Pressed && prevMouseState.LeftButton == ButtonState.Released) { switch (name) { case "New Game": NewGame(); break; case "Load Game": StaticBooleans.SetLoadGamesBool(true); break; case "Statistics": StaticBooleans.SetStatBool(true); break; case "Fight": StartFight(this.character, GameAuth.GetCurrentGame()); break; case "Shop": StaticBooleans.SetOpenShopBool(true); break; case "Buy": BuyIfPossible(this.item, GameAuth.GetCurrentGame()); break; case "Close": StaticBooleans.SetOpenShopBool(false); break; case "Back": if (!StaticBooleans.IsShopOpen) { GameAuth.EndGame(); StaticBooleans.SetLoadGamesBool(false); StaticBooleans.SetStatBool(false); } break; default: LoadGame(this.game); break; } } } }
private void LoadGame(Models.Game game) { Models.Game currentGame = game; GameAuth.SetCurrentGame(currentGame); StaticBooleans.SetIsGameMenuInitializedBool(false); }