Esempio n. 1
0
 /// <summary>
 /// Loads a Tileset from packaged Content.
 /// </summary>
 /// <param name="tilesetName">Content-based path for the tileset.</param>
 /// <param name="engine">The game engine.</param>
 /// <returns>The tileset with that name.</returns>
 public static Tileset getTilesetFromContent(string tilesetName, Engine engine)
 {
     Tileset tileset;
     using (ManagedXml manager = new ManagedXml(engine))
     {
         XmlDocument doc = manager.load(tilesetName);
         tileset = Tileset.getTilesetFromXML(doc, engine.spriteBatch_, engine.GraphicsDevice);
     }
     return tileset;
 }
Esempio n. 2
0
 /// <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;
 }
Esempio n. 3
0
 /// <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;
 }