예제 #1
0
    public void GiveSpeedStat()
    {
        canBuyItem = false;
        itemPrice  = speedStatUpgradePrice[statManager.GetSpeedStatLevel() - 1];
        if (pollenManager.GetPollenCount() >= itemPrice)
        {
            canBuyItem = true;
        }
        if (!canBuyItem)
        {
            print("cannot buy, not enough pollen"); return;
        }

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

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

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

        if (statManager.GetSpeedStatLevel() >= speedStatUpgradePrice.Length)
        {
            speedMaxed = true;
        }
    }