Ejemplo n.º 1
0
    public void Upgrade()
    {
        int upgradePrice = marketScript.GetUpgradePrice();

        if (goldManager.canBuy(upgradePrice))
        {
            goldManager.ChangeGold(-upgradePrice, Vector3.zero);
            bool canUpgradeMore = marketScript.Upgrade();
            UpdateInfo();
            if (!canUpgradeMore)
            {
                upgradeButton.interactable = false;
                upgradePriceText.text      = "";
            }
        }
    }
Ejemplo n.º 2
0
    public void SetTowerLevel(int level)
    {
        GameObject          tower     = Instantiate(GetTowerObject(), new Vector3(-50.0f, 0.0f, 0.0f), Quaternion.identity) as GameObject;
        TowerMarketInfoBase towerInfo = tower.GetComponent <TowerMarketInfoBase>();

        towerInfo.RollBack();

        for (int i = 0; i < level; i++)
        {
            towerInfo.Upgrade();
        }
        if (level == 0)
        {
            string towerName = towerInfo.name;
            towerName             = towerName.Substring(0, towerName.IndexOf("(Clone)")); //Deletes "(Clone)" ending
            upgradeTowerName.text = towerName + " upgrades";
        }
        SetInfo(tower);
        Destroy(tower);
    }