/// <summary> /// Remove the item that resides in this specific slot. /// </summary> /// <param name="slot">The `Slot` to remove /// an item from</param> /// <returns>The `GameObject` in the slot, or null</returns> public override GameObject Remove(Slot slot) { if (slot.Item == null) { return null; } return slot.RemoveItem().gameObject; }
/// <summary> /// This event is automatically fired automatically /// as this object is a MonoBehaviour. If the event /// is already used, or there is an item already /// being dragged, will do nothing. /// </summary> /// <param name="eventData">The `PointerEventData` of the event</param> public void OnBeginDrag(PointerEventData eventData) { if ((eventData != null && eventData.used) || DraggedItem != null) { return; } if (OnBeginDragCallback != null) { OnBeginDragCallback(eventData); } DraggedItem = this; canvasGroup.blocksRaycasts = false; oldSlot = GetComponentInParent<Slot>(); oldSlot.RemoveItem(); // place it in the parent canvas so // it renders above everything else transform.SetParent(canvas.transform); beingDragged = true; // trigger the item did get picked up event ItemEventManager.TriggerItemDidPickup(gameObject, eventData); }