Ejemplo n.º 1
0
        public string GetRandomSpecialization(eTownType town)
        {
            TownSpecializations ts = ts_parser_.Towns.Find(delegate(TownSpecializations s) { return(s.Town == town); });

            if (ts == null || ts.Specializations.Count == 0)
            {
                return(null);
            }
            int i = Randomizer.rnd.Next(ts.Specializations.Count);

            return(ts.Specializations[i]);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// initialization
 /// </summary>
 private void parse(XmlElement xml_data)
 {
     if (xml_data == null || xml_data.ChildNodes.Count == 0)
     {
         throw new Exception("TownSpecialization section not found");
     }
     else
     {
         foreach (XmlNode node in xml_data.ChildNodes)
         {
             TownSpecializations ts = new TownSpecializations(node);
             if (ts.IsParseOK)
             {
                 towns_.Add(ts);
             }
         }
     }
 }