Example #1
0
    private void PurchaseSelectedItemInMenu()
    {
        if (Time.time - lastPurchased > PurchaseCooldown && IsShopStocked)
        {
            Spell toPurchase = GetCurrentSelectedShopItem() as Spell;

            if (playerState.CanAffordPurchase(toPurchase.Price))
            {
                playerState.DeductPoints(toPurchase.Price);
                playerState.AddNewAbilityToHotbar(GetCurrentSelectedShopItem() as Spell);
                DeleteCurrentSelectedShopItem();
            }
            else
            {
                print("You can't afford that!");
            }

            lastPurchased = Time.time;
        }
    }