Exemplo n.º 1
0
    public void GiveEfficiencyStat()
    {
        canBuyItem = false;
        itemPrice  = speedStatUpgradePrice[statManager.GetEfficiencyStatLevel() - 1];
        if (pollenManager.GetPollenCount() >= itemPrice)
        {
            canBuyItem = true;
        }
        if (!canBuyItem)
        {
            print("cannot buy, not enough pollen"); return;
        }

        int nextLevelPrice = speedStatUpgradePrice[statManager.GetEfficiencyStatLevel()];

        pollenManager.AddPollen(-itemPrice);
        statManager.AddEfficiencyStat();

        if (speedStatUpgradePrice.Length - 1 >= statManager.GetEfficiencyStatLevel())
        {
            UpdateEfficiencyPriceText(nextLevelPrice.ToString());
        }
        else
        {
            UpdateEfficiencyPriceText("");
        }

        if (statManager.GetEfficiencyStatLevel() >= speedStatUpgradePrice.Length)
        {
            efficiencyMaxed = true;
        }
    }