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;
         }
     }
 }
示例#2
0
 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();
 }