Пример #1
0
 private void ParseLevelData(mg_bc_Level _level, XmlNode _xmlLevel)
 {
     _level.LevelObjects     = new List <mg_bc_LevelObject>();
     _level.PowerUps         = new List <mg_bc_LevelObject>();
     _level.Goal             = Convert.ToInt32(_xmlLevel.Attributes["Goal"].Value, CultureInfo.InvariantCulture);
     _level.MaxFlyingObjects = Convert.ToInt32(_xmlLevel.Attributes["MaxFlyingObjects"].Value, CultureInfo.InvariantCulture);
     _level.PowerupChance    = (float)Convert.ToDouble(_xmlLevel.Attributes["PowerupChance"].Value, CultureInfo.InvariantCulture);
     if (_xmlLevel.Attributes.GetNamedItem("DropAllowance") != null)
     {
         _level.DropAllowance = Convert.ToInt32(_xmlLevel.Attributes["DropAllowance"].Value, CultureInfo.InvariantCulture);
     }
     if (_xmlLevel.Attributes.GetNamedItem("ThrownBagTypes") != null)
     {
         _level.ThrownBagTypes = Convert.ToInt32(_xmlLevel.Attributes["ThrownBagTypes"].Value, CultureInfo.InvariantCulture);
     }
     if (_xmlLevel.Attributes.GetNamedItem("WrongBagTypes") != null)
     {
         _level.WrongBagTypes = Convert.ToInt32(_xmlLevel.Attributes["WrongBagTypes"].Value, CultureInfo.InvariantCulture);
     }
     if (_xmlLevel.Attributes.GetNamedItem("SpawnDelay") != null)
     {
         _level.SpawnDelay = (float)Convert.ToDouble(_xmlLevel.Attributes["SpawnDelay"].Value, CultureInfo.InvariantCulture);
     }
     foreach (XmlNode childNode in _xmlLevel.ChildNodes)
     {
         ParseXMLChild(childNode, _level);
     }
 }
Пример #2
0
        private void ParseLevelXMLObject(XmlNode _xml, mg_bc_Level _level)
        {
            mg_bc_LevelObject mg_bc_LevelObject2 = new mg_bc_LevelObject();

            _level.LevelObjects.Add(mg_bc_LevelObject2);
            mg_bc_LevelObject2.Type = _xml.Attributes["type"].Value;
            mg_bc_LevelObject2.Odds = Convert.ToInt32(_xml.Attributes["odds"].Value);
            _level.TotalObjectOdds += mg_bc_LevelObject2.Odds;
        }
Пример #3
0
 public virtual bool NextLevel()
 {
     TruckNumber.SetValue(TruckNumber.Value + 1);
     if (TruckNumber.Value > m_levels.Count)
     {
         return(false);
     }
     m_activeLevel = m_levels[TruckNumber.Value - 1];
     CurrentDropAllowance.SetValue(m_activeLevel.DropAllowance);
     return(true);
 }
Пример #4
0
        protected void ParseXMLDoc(XmlDocument _document)
        {
            m_levels = new List <mg_bc_Level>();
            XmlNodeList elementsByTagName = _document.GetElementsByTagName("Truck");

            foreach (XmlNode item in elementsByTagName)
            {
                mg_bc_Level mg_bc_Level2 = new mg_bc_Level();
                m_levels.Add(mg_bc_Level2);
                ParseLevelData(mg_bc_Level2, item);
            }
        }
Пример #5
0
 private void ParseXMLChild(XmlNode _child, mg_bc_Level _level)
 {
     if (_child.Name == "Objects")
     {
         foreach (XmlNode childNode in _child.ChildNodes)
         {
             ParseLevelXMLObject(childNode, _level);
         }
     }
     else
     {
         if (!(_child.Name == "PowerUps"))
         {
             return;
         }
         foreach (XmlNode childNode2 in _child.ChildNodes)
         {
             ParseLevelXMLPowerup(childNode2, _level);
         }
     }
 }