/// <summary> /// Add an Item to the next available Slot.</summary> public void AddItem(SlottableItem item) { Slot slot = NextAvailableSlot(); if (slot != null) { slot.Drop(item); } }
public void OnEndDrag(PointerEventData eventData) { if (!Slot.AllowsDrag) { return; } DraggedItem = null; _canvasGroup.blocksRaycasts = true; if (Slot == _startSlot) { Slot.Drop(this); } }
public void AddItem(SlottableItem item, string slotName = null) { Slot slot = null; if (slotName == null) { slot = NextAvailableSlot(); } else { slot = SlotByName(slotName); } if (slot != null) { slot.Drop(item); } }
public void ResetSlots() { foreach (Slot slot in _slots) { if (slot.Item != null) { slot.Item.gameObject.SetActive(false); Items.Remove(slot.Item.Name.text); slot.Item.Amount = 0; slot.Item.Item = null; SlottableItem item = slot.Item; slot.Clear(); Slot target = NextAvailableSlot(); if (target != null) { target.Drop(item); } } } }