From b858c45b7e52cbe29f5d609c23c7e2a6b98476fb Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Wed, 19 Feb 2020 15:06:52 -0500 Subject: [PATCH] Cycle through levels when player hits the "restart level" button. GitOrigin-RevId: bbe909515fbc4b61be3357e506a113e82bb6e2bd --- Shared/SneakGame.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Shared/SneakGame.cs b/Shared/SneakGame.cs index 3c21a8c..7910c47 100644 --- a/Shared/SneakGame.cs +++ b/Shared/SneakGame.cs @@ -24,6 +24,7 @@ namespace SemiColinGames { // attempt to draw the scene. This is a workaround for the fact that otherwise the first few // frames can be really slow to draw. int framesToSuppress; + int levelIdx = 0; Scene scene; Player player; @@ -72,8 +73,9 @@ namespace SemiColinGames { framesToSuppress = 2; camera = new Camera(); player = new Player(); - world = new World(Levels.ONE_ONE); + world = new World(Levels.ALL_LEVELS[levelIdx % Levels.ALL_LEVELS.Length]); scene = new Scene(GraphicsDevice, camera); + levelIdx++; } // Called once per game. Unloads all game content.