Exemplo n.º 1
0
        public override Building Clone()
        {
            Building newObj = new Tower();
            newObj.sprite = this.sprite.Clone();
            newObj.Range = this.Range;
            newObj.Cost = this.Cost;
            newObj.ArrowTime = this.ArrowTime;
            newObj.LevelReq = this.LevelReq;

            return newObj;
        }
Exemplo n.º 2
0
        public static List<Building> loadTowerInfo(ContentManager Content)
        {
            List<Building> list = new List<Building>();
            XmlDocument doc = new XmlDocument();
            doc.Load(@"Data/tower.dat");

            XmlNodeList towers = doc.SelectNodes("//tower");

            for (int i = 0; i < towers.Count; i++)
            {
                Tower tower = new Tower();
                Texture2D texture = Content.Load<Texture2D>(towers[i].InnerText);
                tower.sprite = new NormalSprite(texture, 0, 0, texture.Width, texture.Height);
                tower.Cost = int.Parse(towers[i].Attributes["cost"].Value);
                tower.Range = int.Parse(towers[i].Attributes["range"].Value);
                tower.ArrowTime = float.Parse(towers[i].Attributes["arrowTime"].Value);
                tower.LevelReq = int.Parse(towers[i].Attributes["levelReq"].Value);

                list.Add(tower);
            }

            return list;
        }