public void SwitchState(GameState gameState) { switch (gameState) { case GameState.LEVEL_1: this.Components.Remove(mainMenu); level3 = new Level3(this); Components.Add(level3); currentLevel = level3; break; case GameState.MAIN_MENU: this.Components.Remove(currentLevel); mainMenu = new MenuJewSaver(this); Components.Add(mainMenu); break; case GameState.LEVEL_2: this.Components.Remove(level1); level2 = new Level2(this); this.Components.Add(level2); currentLevel = level2; break; case GameState.LEVEL_3: this.Components.Remove(level2); level3 = new Level3(this); this.Components.Add(level3); currentLevel = level3; break; default: break; } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here // add game components here this.Components.Add(new Input(this)); mainMenu = new MenuJewSaver(this); this.Components.Add(mainMenu); base.Initialize(); }