示例#1
0
 private static void BombsXML(XmlNode xmlNode, MapModel map)
 {
     for (XmlNode xmlNode1 = xmlNode.FirstChild; xmlNode1 != null; xmlNode1 = xmlNode1.NextSibling)
     {
         if ("BombPositions".Equals(xmlNode1.Name))
         {
             for (XmlNode xmlNode2 = xmlNode1.FirstChild; xmlNode2 != null; xmlNode2 = xmlNode2.NextSibling)
             {
                 if ("Bomb".Equals(xmlNode2.Name))
                 {
                     XmlNamedNodeMap attributes   = (XmlNamedNodeMap)xmlNode2.Attributes;
                     BombPosition    bombPosition = new BombPosition()
                     {
                         X = float.Parse(attributes.GetNamedItem("X").Value),
                         Y = float.Parse(attributes.GetNamedItem("Y").Value),
                         Z = float.Parse(attributes.GetNamedItem("Z").Value)
                     };
                     bombPosition.Position = new Half3(bombPosition.X, bombPosition.Y, bombPosition.Z);
                     if ((double)bombPosition.X == 0.0 && (double)bombPosition.Y == 0.0 && (double)bombPosition.Z == 0.0)
                     {
                         bombPosition.Everywhere = true;
                     }
                     map._bombs.Add(bombPosition);
                 }
             }
         }
     }
 }
示例#2
0
 private static void BombsXML(XmlNode xmlNode, MapModel map)
 {
     for (XmlNode xmlNode3 = xmlNode.FirstChild; xmlNode3 != null; xmlNode3 = xmlNode3.NextSibling)
     {
         if ("BombPositions".Equals(xmlNode3.Name))
         {
             for (XmlNode xmlNode4 = xmlNode3.FirstChild; xmlNode4 != null; xmlNode4 = xmlNode4.NextSibling)
             {
                 if ("Bomb".Equals(xmlNode4.Name))
                 {
                     XmlNamedNodeMap xml4 = xmlNode4.Attributes;
                     BombPosition    bomb = new BombPosition
                     {
                         X = float.Parse(xml4.GetNamedItem("X").Value),
                         Y = float.Parse(xml4.GetNamedItem("Y").Value),
                         Z = float.Parse(xml4.GetNamedItem("Z").Value)
                     };
                     bomb.Position = new Half3(bomb.X, bomb.Y, bomb.Z);
                     if (bomb.X == 0 && bomb.Y == 0 && bomb.Z == 0)
                     {
                         bomb.Everywhere = true;
                     }
                     map._bombs.Add(bomb);
                 }
             }
         }
     }
 }