/// <summary> /// Factory method to load a level from the file system. /// </summary> /// <param name="filepath">Complete path to the level Xml.</param> /// <param name="engine">Game engine.</param> /// <returns>An initialized level.</returns> public static Level getLevelFromFile(string filepath, Engine engine) { Level level; using (ManagedXml manager = new ManagedXml(engine)) { XmlDocument doc = manager.loadFromFile(filepath); level = new Level(false); level.initializeLevelFromXml(doc, engine); } return level; }
/// <summary> /// Factory method to load a level from packaged Content. /// </summary> /// <param name="levelname">Content-based path to the level.</param> /// <param name="engine">Game engine.</param> /// <returns>An initialized level.</returns> public static Level getLevelFromContent(string levelname, Engine engine) { Level level; using (ManagedXml manager = new ManagedXml(engine)) { XmlDocument doc = manager.load(Path.Combine(LEVELS_FOLDER, levelname)); level = new Level(true); level.initializeLevelFromXml(doc, engine); } return level; }