public virtual void OnSlotChange() { Debug.Log("OnSlotChanged"); if (!SlotData.Occupant()) { ItemReference = null; return; } GameManager.ItemDictionary.TryGetValue(SlotData.OccupantItemData.ItemId, out var itemObject); if (itemObject == null) { return; } ItemReference = itemObject.GetComponent <Item>(); }
public Slot(Transform slotTransform, ItemSlotData slotData, int slotIndex) { SlotTransform = slotTransform; SlotData = slotData; SlotIndex = slotIndex; if (!SlotData.Occupant()) { return; } GameManager.ItemDictionary.TryGetValue(SlotData.OccupantItemData.ItemId, out var itemObject); if (itemObject == null) { return; } ItemReference = itemObject.GetComponent <Item>(); }