Example #1
0
    public void UpgradeButtonInteraction()
    {
        int cost = TownBuilding.GetUpgradeCost_WizardsTower(GameDataManager.Instance.dataStore.buildingLv_WizardsTower);

        if (GameDataManager.Instance.SpendManaIfPossible(cost))
        {
            if (GameDataManager.Instance.dataStore.buildingLv_WizardsTower < TownBuilding.buildingTypeMaxLevels[(int)BuildingType.Tower])
            {
                GameDataManager.Instance.dataStore.buildingLv_WizardsTower++;
            }
        }
        else
        {
            shell.SurrenderFocus();
            insufficientResourcesPopup.Open();
        }
    }
Example #2
0
 // Update is called once per frame
 void Update()
 {
     if (GameDataManager.Instance != null)
     {
         if (upgradeButton.activeInHierarchy != (GameDataManager.Instance.dataStore.buildingLv_WizardsTower < TownBuilding.buildingTypeMaxLevels[(int)BuildingType.Tower]))
         {
             upgradeButton.SetActive(GameDataManager.Instance.dataStore.buildingLv_WizardsTower < TownBuilding.buildingTypeMaxLevels[(int)BuildingType.Tower]);
         }
         if (cachedWizardsTowerLv != GameDataManager.Instance.dataStore.buildingLv_WizardsTower)
         {
             cachedWizardsTowerLv = GameDataManager.Instance.dataStore.buildingLv_WizardsTower;
             headerLabel.text     = strings[0] + cachedWizardsTowerLv.ToString();
             infoLabel.text       = strings[baseResGainStringIndex + cachedWizardsTowerLv];
             resManaNo.text       = TownBuilding.GetUpgradeCost_WizardsTower(cachedWizardsTowerLv).ToString();
         }
     }
 }
Example #3
0
    private void _in_UpdateProcessing_PortalArea_postLv7()
    {
        int recs = TownBuilding.GetUpgradeCost_WizardsTower(GameDataManager.Instance.dataStore.buildingLv_WizardsTower);

        _in_UpdateProcessing_PortalArea_reqs(ref recs);
        if (GameDataManager.Instance.CheckManaAvailability(recs))
        {
            if (cachedPortalNextSteps != PortalNextSteps.TowerLv7_ReadyForUpgrade)
            {
                portalNextStepsArea.text = strings[14] + " " + strings[15];
                cachedPortalNextSteps    = PortalNextSteps.TowerLv7_ReadyForUpgrade;
            }
        }
        else if (cachedPortalNextSteps != PortalNextSteps.TowerLv7_NotEnoughMana)
        {
            portalNextStepsArea.text = strings[14] + " " + strings[16];
            cachedPortalNextSteps    = PortalNextSteps.TowerLv7_NotEnoughMana;
        }
    }