Example #1
0
    // Update
    public void FixedUpdate()
    {
        if (item == null && slotChild && slot == Slot.Inventory)
        {
            GetElementItem();
        }
        // if there is a child element in inventory slot
        if (transform.childCount > 0 && slot == Slot.Inventory)
        {
            item = slotChild.GetComponent <Item_Element>().item;
        }
        // if there is a child element in equip slot
        else if (transform.childCount > 1 && slot == Slot.Equip)
        {
            item = slotChild.GetComponent <Item_Element>().item;
        }
        else
        {
            item = null;
        }

        // if the item is not null, and the item to be displayed is not null
        if (item != null)
        {
            // if the player is holding down rightclick and the mouse is currently in the slot
            if ((Input.GetMouseButtonDown(1) || Input.GetMouseButton(1)) && (Inventory_Display_UI.isOpen) && (mouseInSlot))
            {
                idu.Show();
            }
            else if (!mouseInSlot && item == null)
            {
                idu.Hide();
            }
        }
    }