Exemplo n.º 1
0
 public void FromXML(XmlDocument doc)
 {
     EmptyMap ();
     EffectFire fire = new EffectFire ();
     XmlNodeList tiles = doc.SelectNodes ("//tile");
     foreach (XmlNode node in tiles) {
         int x = Convert.ToInt16 (node.Attributes ["x"].InnerText);
         int y = Convert.ToInt16 (node.Attributes ["y"].InnerText);
         Vector v = GetTilePos (x, y);
         TileType typ = (TileType)Enum.Parse (typeof(TileType), node.Attributes ["type"].InnerText, true);
         if (typ == TileType.Fire && editor) {
             map [y] [x].tileGraphic = new Graphic (Color.Orange, Tile.WIDTH, Tile.HEIGHT);
         } else {
             map [y] [x].tileGraphic = lookup [typ].Clone ();
         }
         if (typ == TileType.Fire && !editor) {
             Vector xPos = new Vector (new Point ((int)v.X, (int)v.X + Tile.WIDTH));
             Vector yPos = new Vector (new Point ((int)v.Y - EffectFire.HEIGHT, (int)v.Y -
                     EffectFire.HEIGHT));
             ParticleOptions p = fire.template.Clone ();
             p.xPosRange = xPos;
             p.yPosRange = yPos;
             map [y] [x].system = new ParticleSystem (p);
         }
         map [y] [x].tileType = typ;
         map [y] [x].x = (int)v.X;
         map [y] [x].y = (int)v.Y;
     }
 }
Exemplo n.º 2
0
        public void FromXML(XmlDocument doc)
        {
            EmptyMap();
            EffectFire  fire  = new EffectFire();
            XmlNodeList tiles = doc.SelectNodes("//tile");

            foreach (XmlNode node in tiles)
            {
                int      x   = Convert.ToInt16(node.Attributes ["x"].InnerText);
                int      y   = Convert.ToInt16(node.Attributes ["y"].InnerText);
                Vector   v   = GetTilePos(x, y);
                TileType typ = (TileType)Enum.Parse(typeof(TileType), node.Attributes ["type"].InnerText, true);
                if (typ == TileType.Fire && editor)
                {
                    map [y] [x].tileGraphic = new Graphic(Color.Orange, Tile.WIDTH, Tile.HEIGHT);
                }
                else
                {
                    map [y] [x].tileGraphic = lookup [typ].Clone();
                }
                if (typ == TileType.Fire && !editor)
                {
                    Vector xPos = new Vector(new Point((int)v.X, (int)v.X + Tile.WIDTH));
                    Vector yPos = new Vector(new Point((int)v.Y - EffectFire.HEIGHT, (int)v.Y -
                                                       EffectFire.HEIGHT));
                    ParticleOptions p = fire.template.Clone();
                    p.xPosRange        = xPos;
                    p.yPosRange        = yPos;
                    map [y] [x].system = new ParticleSystem(p);
                }
                map [y] [x].tileType = typ;
                map [y] [x].x        = (int)v.X;
                map [y] [x].y        = (int)v.Y;
            }
        }