Esempio n. 1
0
    public void BuyCurrentItem(int count)
    {
        int finalPrice = currentShopItemInfo.Price * count;

        if (finalPrice <= PlayerStat.Instance.GetStat("Gold"))
        {
            AlertPopup.RefreshToBuyItem(currentItemData.Name, count.ToString(), currentShopItemInfo.Price.ToString());
            AlertPopup.OpenPopup(2.0f);
            PlayerInventory.Instance.AddItemToInventory(new InventoryItem(currentItemData, count));
            PlayerStat.Instance.RemoveGold(finalPrice);
            RefreshPanel();
        }
        else
        {
            AlertPopup.RefreshToAlert("소지금이 부족합니다!");
            AlertPopup.OpenPopup(1.0f);
        }
    }