コード例 #1
0
ファイル: PlayerEntity.cs プロジェクト: treytomes/ASCIIWorld2
        public void ReceiveItem(Item item)
        {
            var itemStack = new ItemStack(item.Id);

            if (Toolbelt.HasCompatibleSlot(itemStack))
            {
                Toolbelt.SetFirstCompatibleSlot(itemStack);
            }
            else if (Inventory.HasCompatibleSlot(itemStack))
            {
                Inventory.SetFirstCompatibleSlot(itemStack);
            }
            else
            {
                throw new InvalidOperationException("The inventories are all full!");
            }
        }