void OnConstructionComplete(UnitTower tower) { if (tower != currentTower) { return; } upgradeOption = currentTower.ReadyToBeUpgrade(); butSell.SetActive(true); txtSell.text = "" + currentTower.GetValueSell(); if (upgradeOption > 0) { butUpgrade.SetActive(true); txtUpgrade.text = "" + currentTower.GetCost(); if (upgradeOption > 1) { butUpgradeAlt1.SetActive(true); txtUpgradeAlt1.text = "" + currentTower.GetCost(1); } else { butUpgradeAlt1.SetActive(false); } } else { butUpgrade.SetActive(false); butUpgradeAlt1.SetActive(false); } }
public void _Show(UnitTower tower, bool showControl = false) { isOn = true; thisObj.SetActive(showControl); rscObj.SetActive(!showControl); currentTower = tower; if (showControl) { if (currentTower.IsInConstruction()) { StartCoroutine(WaitForConstruction()); floatingButtons.SetActive(false); butSell.SetActive(false); butUpgradeAlt1.SetActive(false); butUpgrade.SetActive(false); } else { floatingButtons.SetActive(true); butSell.SetActive(true); txtSell.text = "" + currentTower.GetValueSell(); upgradeOption = currentTower.ReadyToBeUpgrade(); if (upgradeOption > 0) { butUpgrade.SetActive(true); txtUpgrade.text = "" + currentTower.GetCost(); if (upgradeOption > 1) { butUpgradeAlt1.SetActive(true); txtUpgradeAlt1.text = "" + currentTower.GetCost(1); } else { butUpgradeAlt1.SetActive(false); } } else { butUpgrade.SetActive(false); butUpgradeAlt1.SetActive(false); } } } else { int cost = currentTower.GetCost(); txtRsc.text = cost.ToString(); } Update(); txtName.text = tower.unitName; txtDesp1.text = tower.GetDespStats(); txtDesp2.text = tower.GetDespGeneral(); thisObj.SetActive(isOn); }