Simple Buy Item Logic

This commit is contained in:
brausjonas
2023-03-02 22:57:11 +01:00
parent d114520349
commit 62ca8b3cef
21 changed files with 3374 additions and 166 deletions
@@ -0,0 +1,22 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class UIItem : MonoBehaviour
{
public Item item;
public void BuyItem()
{
Player player = ItemShop.currentPlayer;
if (player.coins - item.Cost >= 0)
{
player.AddCoins(-item.Cost);
UIHandler.GetInstance().ButtonBack();
player.AddItem(item);
}
}
}