public void CheckBuyAbility() { if (Tile.activeTile != null) { if (MenuController.messageUI.levelController.GetLevelObject().isActiveAndEnabled) { buyButton.interactable = false; turretMessage.gameObject.SetActive(true); turretMessage.text = badTimeToPlaceMessage; } else if (CurrencyController.CanAfford(turretForSale.cost)) { if (DoesPathAllowTurretConstruction()) { buyButton.interactable = true; turretMessage.gameObject.SetActive(false); } else { buyButton.interactable = false; turretMessage.gameObject.SetActive(true); turretMessage.text = badTurretPlacementMessage; } } else { turretMessage.gameObject.SetActive(true); turretMessage.text = insufficientFundsMessage; } } }
public void UpdateUI() { currentTower = Tile.activeTile.turret; if (currentTower.upgradesTo != null) { if (CurrencyController.CanAfford(currentTower.upgradesTo.cost)) { SetUpgradeButtonActive(true); } upgradeCostText.text = "-$" + currentTower.upgradesTo.cost.ToString(); } else { SetUpgradeButtonActive(false); } sellValueText.text = "$" + currentTower.sellValue.ToString(); }