コード例 #1
0
    public bool AddItem(SlotManager from)
    {
        if (slot.IsEmpty || from.slot.MyItem.MyID == slot.MyItem.MyID)
        {
            if (inventoryManager.DebugMode)
            {
                Debug.Log("Add Items");
            }

            Item tmpItem = from.slot.MyItem;
            int  count   = from.slot.MyStackCount;

            for (int i = 0; i < count; i++)
            {
                if (slot.IsFull)
                {
                    return(false);
                }

                AddItem(tmpItem, 1);
                from.ClearAllItems();
            }

            return(true);
        }

        return(false);
    }