Example #1
0
 // Loads a new level and calls the Garbage collector to more
 public void NewLevel(string levelName)
 {
     try // If there is error, catch it and send it to the ErrorWindow
     {
         CurrentLevel = null;
         GC.Collect();
         CurrentLevel = LevelLoader.Get("Levels/" + levelName);
         CurrentLevel.LoadContent();
         CurrentLevel.Creatures.Add(Player.Creature);
         Game1.WindowManager.GameState = GameState.Playing;
     }
     catch (Exception e)
     {
         Game1.WindowManager.DisplayError(e, "The XML file to load this level could not be found.");
     }
 }