first commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class InventorySlot
|
||||
{
|
||||
public ItemData item;
|
||||
[Min(0)] public int amount;
|
||||
|
||||
public InventorySlot(ItemData item, int amount)
|
||||
{
|
||||
this.item = item;
|
||||
this.amount = Mathf.Max(0, amount);
|
||||
}
|
||||
|
||||
public bool IsEmpty()
|
||||
{
|
||||
return item == null || amount <= 0;
|
||||
}
|
||||
|
||||
public string GetDisplayText()
|
||||
{
|
||||
if (IsEmpty())
|
||||
{
|
||||
return "Пусто";
|
||||
}
|
||||
|
||||
return item.itemName + " x" + amount;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user