Exemplo n.º 1
0
    public void OnItemSelected(Item item)
    {
        ClearResultSlot();

        if (currentSelectedSlot != null)
        {
            currentSelectedSlot.RestoreDefaultSprite();

            if (item != null)
            {
                if (currentSelectedSlot.HasItem())
                {
                    Inventory.AddItem(currentSelectedSlot.GetItem().Id);
                }

                currentSelectedSlot.SelectItem(item);
                SelectNextMixingSlot();
                Inventory.RemoveItem(item.Id);
                inventoryPanel.Refresh();
            }
            else
            {
                EventSystem.current.SetSelectedGameObject(currentSelectedSlot.gameObject);
            }
        }

        currentSelectedSlot = null;
    }
Exemplo n.º 2
0
    private List <Item> GetItemsInSlots()
    {
        List <Item> items = new List <Item>();

        if (slot0.HasItem())
        {
            items.Add(slot0.GetItem());
        }
        if (slot1.HasItem())
        {
            items.Add(slot1.GetItem());
        }
        if (slot2.HasItem())
        {
            items.Add(slot2.GetItem());
        }

        return(items);
    }