public void InitTower(TowerPool towerPool, int ID) { int row, col; row = col = 0; towerPool.towerAttri.towerType = (TowerType)(ID / 100); towerPool.towerAttri.towerLevel = (TowerLevel)(ID % 100); switch (towerPool.towerAttri.towerType) { case TowerType.em_ScenicSpot: row = (int)(TowerLineInExcel.em_ScenicSpotLine); break; case TowerType.em_Catering: row = (int)TowerLineInExcel.em_CateringLine; break; case TowerType.em_Accommodation: row = (int)TowerLineInExcel.em_AccommodationLine; break; case TowerType.em_Film: row = (int)TowerLineInExcel.em_FilmLine; break; case TowerType.em_Shopping: row = (int)TowerLineInExcel.em_ShoppingLine; break; case TowerType.em_Amusement: row = (int)TowerLineInExcel.em_AmusementLine; break; } row = row + (int)towerPool.towerAttri.towerLevel - 1; col = 2; towerPool.name = ReadFromExcel.getStringFromRowColm(row, col); col = 5; towerPool.towerAttri.description = ReadFromExcel.getStringFromRowColm(row, col++); towerPool.towerAttri.cost = ReadFromExcel.getIntFromRowColm(row, col++); //col++; towerPool.towerAttri.upgradeCost = ReadFromExcel.getIntFromRowColm(row, col++); towerPool.towerAttri.price = ReadFromExcel.getIntFromRowColm(row, col++); towerPool.towerAttri.fixCost = ReadFromExcel.getIntFromRowColm(row, col++); towerPool.towerAttri.durability = ReadFromExcel.getIntFromRowColm(row, col++); towerPool.towerAttri.minRange = ReadFromExcel.getFloatFromRowColm(row, col++); towerPool.towerAttri.maxRange = ReadFromExcel.getFloatFromRowColm(row, col++); col++; towerPool.towerAttri.attackInterval = ReadFromExcel.getFloatFromRowColm(row, col++); towerPool.towerAttri.range = towerPool.towerAttri.maxRange; //towerPool.towerAttri.influProbability = ReadFromExcel.getFloatFromRowColm(row,col++); }
// launch initialization and configuration private void Awake() { if (loadParameters) { LoadParameters(); } if (autoPartParameters) { partMaxScale = towerPartPrefab.transform.localScale; } if (!towerPool) { towerPool = gameObject.AddComponent <TowerPool>(); towerPool.SetPrefab(towerPartPrefab); towerPool.SetController(this); } Restart(); }
protected override void Awake() { Instance = this; base.Awake(); }