コード例 #1
0
        public Item ReplaceItemInSlot(Item item, int slot)
        {
            var oldItem = equipmentList[slot].item;

            equipmentList[slot].item = item;
            UIEventHandlers.InventoryUpdate();
            return(oldItem);
        }
コード例 #2
0
        public Item PopItemFromSlot(int slot)
        {
            var item = equipmentList[slot].item;

            equipmentList[slot].item = null;
            UIEventHandlers.InventoryUpdate();
            return(item);
        }
コード例 #3
0
 public bool AddToFirstEmptySlot(Item item)
 {
     for (int i = 0; i < equipmentList.Length; i++)
     {
         if (equipmentList[i].item == null)
         {
             equipmentList[i].item = item;
             UIEventHandlers.InventoryUpdate();
             return(true);
         }
     }
     return(false);
 }