private static void LoadTower() { towerDBPrefab = TowerDB.LoadDB(); towerList = towerDBPrefab.towerList; for (int i = 0; i < towerList.Count; i++) { //towerList[i].prefabID=i; if (towerList[i] != null) { towerIDList.Add(towerList[i].prefabID); if (towerList[i].stats.Count == 0) { towerList[i].stats.Add(new UnitStat()); } } else { towerList.RemoveAt(i); i -= 1; } } UpdateTowerNameList(); }
protected override void Initialize() { TowerDB towerDBPrefab = TowerDB.LoadDB(); List <UnitTower> towers = towerDBPrefab.towerList; foreach (UnitTower tower in towers) { if (tower.IsHero()) { if (tower.stats.Count == 0) { tower.stats.Add(new UnitStat()); } units.Add(tower as UnitHero); } } }