private void parseListXML(string xml)
        {
            bool endOfList = false;
            XmlReader reader = XmlReader.Create(new StringReader(xml));

            while (!endOfList)
            {
                try
                {
                    reader.ReadToFollowing("Building");
                    buildingTypes.Add(reader.ReadElementContentAsString());
                }
                catch
                {
                    endOfList = true;
                }
            }
            reader.Close();

            foreach (string s in buildingTypes)
            {
                BuildingStats stats = new BuildingStats();
                statsDict.Add(s, stats);

                string xmlBuilding = readFile(BASE_DIR + s + ".xml");

                readBuildingXML(xmlBuilding);

                Console.WriteLine(stats.ToString());
            }
        }
 /// <summary>
 /// Constructor that defines the requirements for a Building.
 /// </summary>
 /// <param name="unitReqs">List of UnitStats of Units needed.</param>
 /// <param name="buildingReqs">List of BuildingStats of Buildings needed.</param>
 /// <param name="bstats">BuildingStats of the kind of Building the requirements are being defined for.</param>
 public ReqList(List<UnitStats> unitReqs, List<BuildingStats> buildingReqs, BuildingStats bstats)
 {
     this.unitReqs = unitReqs;
     this.buildingReqs = buildingReqs;
     this.bstats = bstats;
     type = ReqType.Building;
 }
 /// <summary>
 /// Given a BuildingStats object, this function will return a ReqList defining the requirements necessary to build 
 /// that Building.
 /// </summary>
 /// <param name="bstats"></param>
 /// <returns></returns>
 public ReqList getBuildingRequirements(BuildingStats bstats)
 {
     return this.buildingReqs[bstats];
 }
 /// <summary>
 /// This function will determine if a Player meets the requirements to produce a Building.
 /// </summary>
 /// <param name="player">Playe being tested.</param>
 /// <param name="bstats">BuildingStats defining the Building.</param>
 /// <returns>true if the player meets the requirements, false if the player does not.</returns>
 public bool playerMeetsRequirements(Player.Player player, BuildingStats bstats)
 {
     ReqList reqList = buildingReqs[bstats];
     return reqList.playerMeetsReqs(player);
 }
 public Building(Player.Player owner, BuildingStats stats)
     : base(owner, stats.maxHealth, stats.width, stats.height)
 {
     this.stats      = stats;
     this.entityType = EntityType.Building;
 }
        public bool isCompleted = false; // Has this building ever been completly built?

        public Building(Player.Player owner, short health, byte width, byte height)
            : base(owner, health, width, height)
        {
            this.stats      = new BuildingStats();
            this.entityType = EntityType.Building;
        }
 /// <summary>
 /// Contructor. Given an xml string and a BuildingStats object, this constructor will create a ReqList object for the 
 /// Building defined by bstats based on the requirements described in the xml string.
 /// </summary>
 /// <param name="xml"></param>
 /// <param name="bstats"></param>
 public ReqList(string xml, BuildingStats bstats)
 {
     this.unitReqs = new List<UnitStats>();
     this.buildingReqs = new List<BuildingStats>();
     this.bstats = bstats;
     type = ReqType.Building;
     readReqXML(xml);
 }
 private bool playerHasBuilding(Player.Player player, BuildingStats bstats)
 {
     List<Entity> entities = player.getEntities();
     foreach (Entity e in entities)
     {
         if (e.entityType == Entity.EntityType.Building)
         {
             Building b = (Building)e;
             if (b.stats.buildingType == bstats.buildingType)
             {
                 return true;
             }
         }
     }
     return false;
 }
 public Building(Player.Player owner, BuildingStats stats)
     : base(owner, stats.maxHealth, stats.width, stats.height)
 {
     this.stats = stats;
     this.entityType = EntityType.Building;
 }
 public Building(Player.Player owner, short health, byte width, byte height)
     : base(owner, health, width, height)
 {
     this.stats = new BuildingStats();
     this.entityType = EntityType.Building;
 }