private void LoadFromXml(string xmlLocation, ContentManager content) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(xmlLocation); //m_Background = new BasicBackground(xmlDoc.SelectSingleNode("//Room/Background"), content); //m_Background = new StarBackground(content); m_EntityLayer = int.Parse(xmlDoc.SelectSingleNode("//Room/EntityLayer").InnerText); XmlNodeList tilemapNodes = xmlDoc.SelectNodes("//Room/Tilemaps/Tilemap"); Console.WriteLine(tilemapNodes.Count); for (int i = 0; i < tilemapNodes.Count; i++) { if (i < m_EntityLayer) { m_PreEntityTilemaps.Add(new Tilemap(tilemapNodes[i], content, StaticSettings.GetTileWidth(), StaticSettings.GetTileHeight())); } else { m_PostEntityTilemaps.Add(new Tilemap(tilemapNodes[i], content, StaticSettings.GetTileWidth(), StaticSettings.GetTileHeight())); } } XmlNodeList collisionPolygonNodes = xmlDoc.SelectNodes("//Room/CollisionData/Polygon"); foreach (XmlNode polygonNode in collisionPolygonNodes) { string[] posStrings = polygonNode.SelectSingleNode("Position").InnerText.Split(','); Vector2 position = new Vector2(float.Parse(posStrings[0]), float.Parse(posStrings[1])); m_CollisionVerts.Add(new List <Vector2>()); string[] vertStrings = polygonNode.SelectSingleNode("Verts").InnerText.Split('|'); foreach (string s in vertStrings) { m_CollisionVerts[m_CollisionVerts.Count - 1].Add(new Vector2(float.Parse(s.Split(',')[0]) + position.X, float.Parse(s.Split(',')[1]) + position.Y)); } } }