public override void OnDrop(PointerEventData eventData)
        {
            ItemDragHandler itemDragHandler = eventData.pointerDrag.GetComponent <ItemDragHandler>();

            if (itemDragHandler == null)
            {
                return;
            }

            InventorySlot inventorySlot = itemDragHandler.ItemSlotUI as InventorySlot;

            if (inventorySlot != null)
            {
                SlotItem = inventorySlot.ItemSlot.item;
                return;
            }

            HotbarSlot hotbarSlot = itemDragHandler.ItemSlotUI as HotbarSlot;

            if (hotbarSlot != null)
            {
                HotbarItem oldItem = SlotItem;
                SlotItem            = hotbarSlot.SlotItem;
                hotbarSlot.SlotItem = oldItem;
                return;
            }
        }
Exemple #2
0
 public void GetSelected()
 {
     foreach (HotbarSlot hotbarSlot in hotbarSlots)
     {
         if (hotbarSlot.isSelected = true)
         {
             selected = hotbarSlot;
         }
     }
 }