Esempio n. 1
0
    public void OnEndDrag(PointerEventData data)
    {
        if (isImgOnly)
        {
            return;
        }
        itemImage.transform.SetParent(this.transform, true);
        itemImage.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;

        ItemSlot target = RaycastMouse().Select(a => a.gameObject.GetComponent <ItemSlot>()).FirstOrDefault(a => a != null);

        if (target == null || target.isEquipmentSlot == false || target.item != null)
        {
            if (this.isEquipmentSlot == true)
            {
                parent.UnequipItem(this);
            }
            return;
        }

        if (this.isEquipmentSlot == false)
        {
            parent.EquipItem(this);
        }
        if (this.isEquipmentSlot == true)
        {
            parent.UnequipItem(this);
        }
    }