Esempio n. 1
0
    public void OnPointerExit(PointerEventData dataName)
    {
        holder  = GameObject.FindGameObjectWithTag("InventoryCursor").GetComponent <iconHolder> ();
        inv     = GameObject.FindGameObjectWithTag("Inventory").GetComponent <inventory> ();
        descBox = holder.descBox;
        desc    = holder.desc;

        if (assignedTo.name != "nullItem")
        {
            descBox.SetActive(false);
            desc.text = null;
        }
    }
Esempio n. 2
0
    public void OnPointerDown(PointerEventData eventData)
    {
        holder  = GameObject.FindGameObjectWithTag("InventoryCursor").GetComponent <iconHolder> ();
        inv     = GameObject.FindGameObjectWithTag("Inventory").GetComponent <inventory> ();
        descBox = holder.descBox;
        desc    = holder.desc;

        if (!holder.holding)
        {
            if (assignedTo.name != "nullItem")
            {
                holder.held    = assignedTo;
                holder.holding = true;
                holder.GetComponent <Image> ().enabled = true;
                holder.GetComponent <Image> ().sprite  = assignedTo.sprite;
                inv.RemoveItematPoint(assignedTo, slot);
            }
        }
        else if (holder.holding)
        {
            if (assignedTo.name != "nullItem")
            {
                inv.AddItem(holder.held);
                holder.held    = assignedTo;
                holder.holding = false;
                holder.GetComponent <Image> ().enabled = true;
                holder.GetComponent <Image> ().sprite  = assignedTo.sprite;
            }
            else if (assignedTo.name == "nullItem")
            {
                inv.AddItematPoint(holder.held, slot);
                holder.held    = assignedTo;
                holder.holding = false;
                holder.GetComponent <Image> ().enabled = false;
                holder.GetComponent <Image> ().sprite  = null;
            }
        }
    }