public void SwitchToNextLevel() { currentLevel++; if (currentLevel > TOTAL_LEVELS) { currentLevel = 1; } //currentLevel = currentLevel % LevelList.Count; //activeLevel = (LevelData)LevelList.ToArray()[currentLevel]; //activeLevel.startLevel(ScreenManager.Game); if (activeLevel != null) { activeLevel.clearLevel(ScreenManager.Game); activeLevel = null; } switch (currentLevel) { case 1: activeLevel = new Level1(ScreenManager.Game, this); break; case 2: activeLevel = new Level2(ScreenManager.Game, this); break; case 3: activeLevel = new Level3(ScreenManager.Game, this); break; case 4: activeLevel = new Level4(ScreenManager.Game, this); break; case 5: activeLevel = new Level5(ScreenManager.Game, this); break; default: break; } activeLevel.startLevel(ScreenManager.Game); player.position = activeLevel.startingLocation; player.velocity = Vector3.Zero; player.netForce = Vector3.Zero; manualCameraRotation = 0.0f; ScreenManager.Game.Components.Add(player); m_kCountdownTimer = new Utils.CountdownTimer(ScreenManager.Game, new Vector2(875.0f, 20.0f)); m_kScoreKeeper = new Utils.ScoreKeeper(ScreenManager.Game, new Vector2(20f, 20f)); m_kScoreKeeper.setScore(score); ScreenManager.Game.Components.Add(m_kCountdownTimer); ScreenManager.Game.Components.Add(m_kScoreKeeper); ScreenManager.Game.Components.Add(sky); }
public void RestartLevel() { UnloadContent(); //activeLevel = (LevelData)LevelList.ToArray()[currentLevel]; activeLevel.startLevel(ScreenManager.Game); player.position = activeLevel.startingLocation; player.velocity = Vector3.Zero; player.netForce = Vector3.Zero; ScreenManager.Game.Components.Add(player); m_kCountdownTimer = new Utils.CountdownTimer(ScreenManager.Game, new Vector2(875.0f, 20.0f)); m_kScoreKeeper = new Utils.ScoreKeeper(ScreenManager.Game, new Vector2(20f, 20f)); m_kScoreKeeper.setScore(score); ScreenManager.Game.Components.Add(m_kCountdownTimer); ScreenManager.Game.Components.Add(m_kScoreKeeper); ScreenManager.Game.Components.Add(sky); manualCameraRotation = 0.0f; }