private void UpdateGameState() { if (GameState == 2) { Map.MapChanges(); Map.SortObjectToDraw(); if (Scorebar.CheckWin()) { GameState++; } } else if (GameState == 0) { GameState = StartMenu.CheckKeysPressed(MouseState, OldMouseState, GameState); } else if (GameState == 1) { GameState = SelectCharactersMenu.CheckKeysPressed(MouseState, OldMouseState, GameState); } else if (GameState == 3) { GameState = EndGameMenu.CheckKeysPressed(MouseState, OldMouseState, GameState); } }
private void PrepareGame() { if (GameState == 2 && OldGameState == 1) { Map.SetCharacterType(SelectCharactersMenu.GetCharacterPlay()); Scorebar.SetCharacter(SelectCharactersMenu.GetCharacterPlay()); } }
private void LoadTexturesToScoreBar() { Texture2D[] characterHead = new Texture2D[4]; for (int i = 1; i <= 4; i++) { string name = "Sprites\\headScore" + i; characterHead[i - 1] = Content.Load <Texture2D>(name); } Scorebar.LoadScoreboardTextures(characterHead, Content.Load <Texture2D>("Sprites\\chest"), Content.Load <Texture2D>("Sprites\\chestBack"), new Texture2D(GraphicsDevice, 1, 1)); }
protected override void Draw(GameTime gameTime) //draw { GraphicsDevice.Clear(Color.BurlyWood); SpriteBatch.Begin(); // draw here switch (GameState) { case 0: { StartMenu.DrawMenu(SpriteBatch); break; } case 1: { SelectCharactersMenu.DrawMenu(SpriteBatch); break; } case 2: { Scorebar.DrawScorebar(SpriteBatch); Map.DrawMap(SpriteBatch); break; } case 3: { EndGameMenu.DrawMenu(SpriteBatch); break; } } DrawSoundButton(); SpriteBatch.End(); base.Draw(gameTime); Map.ApocalypseCondition(60);//if map time so long put random bomb in map every 20 frames Map.DelayScreen(); }