Ejemplo n.º 1
0
    public void OnDrop(PointerEventData eventData)
    {
        RectTransform inventPanel = transform as RectTransform;

        if (!RectTransformUtility.RectangleContainsScreenPoint(inventPanel, Input.mousePosition))
        {
            BaseInventoryObject item = eventData.pointerDrag.gameObject.GetComponent <ItemDragHandler>().Item;
            if (item == null)
            {
                return;
            }
            if (!item.CanBePlaced())
            {
                return;
            }

            ItemPlaced?.Invoke(item);
        }
    }
Ejemplo n.º 2
0
 private void OnItemDroppedIn(ItemDroppedEventData data)
 {
     ItemPlaced?.Invoke(data.InventoryItem.Item);
 }
Ejemplo n.º 3
0
 private void OnInventoryItemRightClicked(InventoryItem item)
 {
     ItemPlaced?.Invoke(item.Item);
 }