using System.Collections;
using System.Collections.Generic;
using UnityEngine;
///
/// 库存插槽
///
public class InventorySlot {
/// 数量
public int count;
/// 物品
public InventoryItem item;
// /// 图片
public Sprite Sprite => item != null ? item.sprite : null;
// /// 堆叠数量
public int MaxStack => item != null ? item.MaxStack : 0;
public InventorySlot() { }
public InventorySlot(InventoryItem item, int count) {
this.item = item;
this.count = count;
}
/// 设置
public void Settings(InventoryItem item, int count) {
this.item = item;
this.count = count;
}
/// 是否相同
public bool Same(InventoryItem obj) {
return item != null && item.name == obj.name && count < MaxStack;
}
}