示例#1
0
    /// <summary>
    /// This function is used to increase the power level of a talent. This function also checks
    /// if the taletn can be bought or not.
    /// </summary>
    /// <param name="text"></param>
    public void IncreasePowerLevel(TextMeshProUGUI text)
    {
        string name  = text.gameObject.transform.parent.name;
        int    coins = info.BuyLevel(name);

        if (coins > 0)
        {
            if (info.GetMaxPowerLevel(name) == info.GetPowerLevel(name))
            {
                text.text = "MAXED";
            }
            else
            {
                text.text = info.GetPowerLevel(name) + "/" + info.GetMaxPowerLevel(name) + "\n" + info.GetBuyAmmount(name);
            }
            tempCoins.text = info.GetCoinCount().ToString("00000000");
        }
        else if (coins == 0)
        {
            print("MAX LEVEL");
            text.text = "MAXED";
        }
        else
        {
            print("NO ENOUGH COINS");
        }
    }