Inventory implemented
This commit is contained in:
@@ -5,7 +5,7 @@ using TMPro;
|
||||
using UnityEngine.UI;
|
||||
public class ItemShop : MonoBehaviour
|
||||
{
|
||||
public ShopItemData selectedItem;
|
||||
public InventoryItem selectedItem;
|
||||
|
||||
public Image itemImage;
|
||||
public TMP_Text itemTxt;
|
||||
@@ -21,7 +21,7 @@ public class ItemShop : MonoBehaviour
|
||||
SelectShopItem(selectedItem);
|
||||
}
|
||||
|
||||
public void SelectShopItem(ShopItemData selected){
|
||||
public void SelectShopItem(InventoryItem selected){
|
||||
selectedItem = selected;
|
||||
|
||||
if(selectedItem==null){Debug.LogError("Null shop item selected, Please check this"); return;}
|
||||
@@ -44,6 +44,7 @@ public class ItemShop : MonoBehaviour
|
||||
buyBtn.interactable=false;
|
||||
await DBmanager.SetCoins(DBmanager.Coins - selectedItem.price);
|
||||
DBmanager.SetGems(DBmanager.Gems- selectedItem.gems);
|
||||
DBmanager.AddInventoryItem(selectedItem);
|
||||
SelectShopItem(selectedItem);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user