Files
OTG_3/Assets/_Scripts/InventorySlot.cs
T

30 lines
520 B
C#
Raw Normal View History

2026-06-04 18:31:31 +03:00
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;
}
}