/// <summary> /// Updates the state of the game. This method checks the GameScreen.IsActive /// property, so the game will stop updating when the pause menu is active, /// or if you tab away to a different application. /// </summary> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); if (load) { if (level.IsLevelUp) { load = false; if (BitSitsGames.ScoreData.CurrentLevel < gameContent.levelIndex + 1) BitSitsGames.ScoreData.CurrentLevel = gameContent.levelIndex + 1; if (BitSitsGames.ScoreData.HighScores[gameContent.levelIndex] < level.Score) BitSitsGames.ScoreData.HighScores[gameContent.levelIndex] = level.Score; MessageBoxScreen m = new MessageBoxScreen(gameContent.levelUp, true); m.Accepted += MessageBoxAccepted; ScreenManager.AddScreen(m, null); } else if (level.ReloadLevel) { load = false; MessageBoxScreen m = new MessageBoxScreen(gameContent.retry, true); m.Accepted += MessageBoxAccepted; ScreenManager.AddScreen(m, null); } } if (IsActive) level.Update(gameTime); }
/// <summary> /// Updates the state of the game. This method checks the GameScreen.IsActive /// property, so the game will stop updating when the pause menu is active, /// or if you tab away to a different application. /// </summary> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); if (m == null) { if (level.IsLevelUp) { m = new MessageBoxScreen(gameContent.levelUp, "Total = " + prevScore + " + " + (level.Score + level.Bonus) + " = " + (Score + level.Bonus)); BitSitsGames.ScoreData.CurrentLevel = levelIndex; BitSitsGames.ScoreData.PrevScore = Score; if (levelIndex == MaxLevelIndex) { BitSitsGames.ScoreData.CurrentLevel = 0; BitSitsGames.ScoreData.PrevScore = 0; bool newHighScore = BitSitsGames.ScoreData.SetHighScore(Score + level.Bonus); m = new MessageBoxScreen(newHighScore ? gameContent.gameOverNewHigh : gameContent.gameOver, "Total = " + (Score + level.Bonus) + (newHighScore ? " **" : "")); } m.Accepted += MessageBoxAccepted; ScreenManager.AddScreen(m, ControllingPlayer); } else if (level.ReloadLevel) { m = new MessageBoxScreen("Reload Level!"); m.Accepted += MessageBoxAccepted; ScreenManager.AddScreen(m, ControllingPlayer); } } if (IsActive) level.Update(gameTime); }
private void LoadNextLevel() { // Unloads the content for the current level before loading the next one. if (level != null) { // Update Score prevScore += level.Score + level.Bonus; tempScore = 0; level.Dispose(); } // Load the level. level = new Level(ScreenManager, levelIndex); levelIndex += 1; m = null; }
/// <summary> /// Updates the state of the game. This method checks the GameScreen.IsActive /// property, so the game will stop updating when the pause menu is active, /// or if you tab away to a different application. /// </summary> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); if (load) { if (level.IsLevelUp) { load = false; MessageBoxScreen m = new MessageBoxScreen(gameContent.levelUp, true); m.Accepted += MessageBoxAccepted; m.Cancelled += MessageBoxAccepted; ScreenManager.AddScreen(m, null); } else if (level.ReloadLevel) { load = false; MessageBoxScreen m = new MessageBoxScreen(gameContent.retry, true); m.Accepted += MessageBoxAccepted; m.Cancelled += MessageBoxAccepted; ScreenManager.AddScreen(m, null); } } if (IsActive) level.Update(gameTime); }
/// <summary> /// Updates the state of the game. This method checks the GameScreen.IsActive /// property, so the game will stop updating when the pause menu is active, /// or if you tab away to a different application. /// </summary> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); if (m == null) { if (level.IsLevelUp) { m = new MessageBoxScreen("Level Up!"); BitSitsGames.ScoreData.Level = levelIndex; BitSitsGames.ScoreData.Score = Score; BitSitsGames.ScoreData.Stars = Stars; if (levelIndex == MaxLevelIndex) { m = new MessageBoxScreen("Game Over"); BitSitsGames.ScoreData.Level = 0; BitSitsGames.ScoreData.Score = BitSitsGames.ScoreData.Stars = 0; } m.Accepted += MessageBoxAccepted; //ScreenManager.AddScreen(m, ControllingPlayer); LevelUpScreen l = new LevelUpScreen(false, level.Score >= level.starScore); l.Accepted += MessageBoxAccepted; ScreenManager.AddScreen(l, null); } else if (level.ReloadLevel) { m = new MessageBoxScreen("Reload Level!"); m.Accepted += MessageBoxAccepted; ScreenManager.AddScreen(m, ControllingPlayer); } } if (IsActive) level.Update(gameTime); }
/// <summary> /// Updates the state of the game. This method checks the GameScreen.IsActive /// property, so the game will stop updating when the pause menu is active, /// or if you tab away to a different application. /// </summary> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); if (load) { if (level.IsLevelUp) { load = false; MessageBoxScreen m; if (levelIndex == MaxLevelIndex) { m = new MessageBoxScreen(gameContent.gameOver, true); m.text = " = " + (prevScore + level.Score).ToString(); } else { m = new MessageBoxScreen(gameContent.levelUp, true); m.text = " = " + prevScore.ToString() + " + " + level.Score.ToString() + " = " + (prevScore + level.Score).ToString(); } m.Accepted += MessageBoxAccepted; m.Cancelled += MessageBoxAccepted; ScreenManager.AddScreen(m, null); } else if (level.ReloadLevel) { load = false; MessageBoxScreen m = new MessageBoxScreen(gameContent.retry, true); m.Accepted += MessageBoxAccepted; m.Cancelled += MessageBoxAccepted; ScreenManager.AddScreen(m, null); } } if (IsActive) level.Update(gameTime); }
private void LoadNextLevel() { // Unloads the content for the current level before loading the next one. if (level != null) { // Update Score prevScore = Score; tempScore = prevScore; level.Dispose(); } // Load the level. level = new Level(ScreenManager, levelIndex); levelIndex += 1; m = null; ScreenManager.AddScreen(new PauseMenuScreen(), ControllingPlayer); }
/// <summary> /// Updates the state of the game. This method checks the GameScreen.IsActive /// property, so the game will stop updating when the pause menu is active, /// or if you tab away to a different application. /// </summary> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); if (m == null) { if (level.IsLevelUp) { m = new MessageBoxScreen(gameContent.levelUp, " = " + prevScore.ToString() + " + " + level.Score.ToString() + " = " + (prevScore + level.Score).ToString()); BitSitsGames.ScoreData.Level = levelIndex; BitSitsGames.ScoreData.Score = Score; if (levelIndex == MaxLevelIndex) { m = new MessageBoxScreen(gameContent.gameOver, " = " + (prevScore + level.Score).ToString()); BitSitsGames.ScoreData.Level = BitSitsGames.ScoreData.Score = 0; } m.Accepted += MessageBoxAccepted; ScreenManager.AddScreen(m, ControllingPlayer); } else if (level.ReloadLevel) { m = new MessageBoxScreen(gameContent.retry, null); m.Accepted += MessageBoxAccepted; ScreenManager.AddScreen(m, ControllingPlayer); } } if (IsActive) level.Update(gameTime); }