Esempio n. 1
0
    public void Purchase()
    {
        // subtract current cost from players points
        if (canPurchase())
        {
            playerData.points.Value -= upgradeNextLevelCost.Value;

            // increase level of the upgrade
            upgradeLevel.Value++;

            //set the new cost based on the curve
            float curveValue = upgradeCurve.GetValue(upgradeLevel.Value);
            Debug.Log("Curve Value is " + curveValue);
            upgradeNextLevelCost.Value = Mathf.CeilToInt(upgradeBaseCost.Value * curveValue);

            Debug.Log("Upgraded " + upgradeName + " new cost is " + upgradeNextLevelCost.Value + " level is " + upgradeLevel.Value);
        }
    }