예제 #1
0
    //Override this if there are different circumstances around handling trying to put an item into a slot
    public virtual void HandlePointerClick()
    {
        GameObject selectedItem = InventoryItemController.GetSelectedItem();

        if (selectedItem != null)
        {
            if (isOccupied)
            {
                //If occupied, swap
                InventoryItemController.SetSelectedItem(SwapItem(selectedItem));
            }
            else
            {
                //else, just store item
                StoreItem(selectedItem);
                InventoryItemController.ResetSelectedItem();
            }
        }
        else if (selectedItem == null && isOccupied == true)
        {
            // If we are on a slot && don't have a selected item && there's an item present
            InventoryItemController.SetSelectedItem(GetItem());
        }
    }