public void ExchangeWithSlotOnDrop(ItemSlotDropHandler destinationSlot)
    {
        // this is an item being dragged slot
        // get item drag handler in destination slot
        InventoryItemDragHandler destinationItemDragHandler = destinationSlot.GetComponentInChildren <InventoryItemDragHandler>();

        // move item being dragged (source) into destination slot
        InventoryItemDragHandler.itemBeingDragged.SetParent(destinationSlot);
        // move destination drag handler into this slot
        destinationItemDragHandler.SetParent(this);
        // raise events
        itemHasBeenDroppedIntoTheItemSlotEvent.Raise(this);
        itemHasBeenDroppedIntoTheItemSlotEvent.Raise(destinationSlot);
    }
Beispiel #2
0
 void ChangeItemParent(ItemSlotDropHandler itemSlotDropHandler)
 {
     // move InventoryItem to the new parent object
     itemSlotDropHandler.GetComponentInChildren <InventoryItemDragHandler>().LInventoryItem.transform.SetParent(itemSlotDropHandler.GetParentObjectTransform());
 }