public void BuildTowerOnCurrentSlot(TowerData tData, Slot baseSlot) { PlayerDataController.Inst.SubtractFinance(tData.buildPrice); Tower tower = Instantiate(GetPrefabByTowerType(tData.towerType)); tower.transform.localPosition = baseSlot.transform.localPosition; tower.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); towersList.Add(tower); }
public void Setup(List <TowersTypes> towerTypes, Slot baseSlot) // setup modal win for building new tower over slot { foreach (TowersTypes t in towerTypes) { PriceItem pI = Instantiate(priceItemPrefab, parentForPriceItems); TowerData tData = SOController.Inst.GetTowerDataByType(t); pI.priceTower = tData.buildPrice; pI.Setup(tData.buildPrice, t, () => { TowerController.Inst.BuildTowerOnCurrentSlot(tData, baseSlot); Destroy(); }); priceItemsList.Add(pI); } }