Ejemplo n.º 1
0
        public static void StaticLoad(XmlDocument doc, XmlElement parent, World world)
        {
            if (hasLoaded)
            {
                return;
            }

            XmlElement mainElem = XmlHelper.GetElement("TileUnLocated", parent);

            Tile.UnLocatedTile = new Dictionary <string, Tile>();
            if (mainElem != null)
            {
                foreach (XmlElement tileElem in mainElem.ChildNodes)
                {
                    string type = (string)XmlHelper.GetSimpleNodeContent <string>("Type", tileElem, "DecorativeTile");
                    Tile   tile = GetTile(type, world);

                    if (tile != null)
                    {
                        tile.Load(doc, tileElem, world);
                        tile.GroundSprite  = world.Resources.GetSprite((string)XmlHelper.GetSimpleNodeContent <string>("Ground", tileElem, "base"));
                        tile.depthModifier = (float)XmlHelper.GetSimpleNodeContent <float>("Depth", tileElem, 0.0f);
                        Tile.UnLocatedTile.Add(tileElem.Name, tile);
                    }
                }
            }
            else
            {
                Tile.UnLocatedTile.Add("Grass", new DecorativeTile(world, world.Resources.GetSprite("tile_grass")));
                Tile.UnLocatedTile.Add("Flower", new AnimatedTile(world, new Animation(world.Resources, new string[] { "" }, 2f)));
            }
            hasLoaded = true;
        }