From b4655a9b42a000d8ac2ee1a8e575632cd30ac56a Mon Sep 17 00:00:00 2001 From: Adam Graham Date: Thu, 16 Sep 2021 09:00:08 -0500 Subject: [PATCH] Update comments --- Assets/Scripts/GameManager.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 8159dfb..c96e791 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -37,12 +37,15 @@ private void LoadLevel(int level) { this.level = level; - // Load the win scene if you have beaten all of the levels. - if (level > NUM_LEVELS) { - SceneManager.LoadScene("Winner"); - } else { - SceneManager.LoadScene("Level" + level); + if (level > NUM_LEVELS) + { + // Start over again at level 1 once you have beaten all the levels + // You can also load a "Win" scene instead + LoadLevel(1); + return; } + + SceneManager.LoadScene("Level" + level); } private void OnLevelLoaded(Scene scene, LoadSceneMode mode) @@ -68,6 +71,7 @@ private void ResetLevel() this.paddle.ResetPaddle(); this.ball.ResetBall(); + // Resetting the bricks is optional // for (int i = 0; i < this.bricks.Length; i++) { // this.bricks[i].ResetBrick(); // } @@ -75,8 +79,8 @@ private void ResetLevel() private void GameOver() { - // SceneManager.LoadScene("GameOver"); - + // Start a new game immediately + // You can also load a "GameOver" scene instead NewGame(); }