Exemplo n.º 1
0
    void HandleGridCellClick(InventoryGridCell cell)
    {
        InventoryItemType oldItem = cursorItem;
        InventoryItemType newItem = cell.GetItem();

        if (oldItem != newItem)
        {
            // Select item into new cursor
            cursorItem    = newItem;
            cursor.sprite = iconRef.GetSpriteForItem(newItem);

            // Swap old cursor item into inventory
            cell.SetItem(oldItem);

            if (oldItem == InventoryItemType.Empty)
            {
                lastSelectedEmptyCell = cell;
            }
        }
    }