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

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

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

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

        if (statManager.GetCarryStatLevel() >= speedStatUpgradePrice.Length)
        {
            carryMaxed = true;
        }
    }