Beispiel #1
0
        protected virtual void TakeFromItem(ItemBase it, int amount)
        {
            if (!CanTake(it))
            {
                return;
            }

            if (IsEmpty())
            {
                SetItem((ItemBase)Activator.CreateInstance(it.GetType()));
            }

            item.TakeFromItem(it, amount);
            RefreshAmount();
        }
Beispiel #2
0
 public static void _PickUpItem(ItemBase item, List <InventorySystem.Cell> Cells)
 {
     foreach (var cell in Cells.FindAll(c => c.Item != null && c.Item.GetType() == item.GetType()))
     {
         cell.PickUpItem(item);
         if (item.Amount == 0)
         {
             return;
         }
     }
     foreach (var cell in Cells)
     {
         cell.PickUpItem(item);
         if (item.Amount == 0)
         {
             return;
         }
     }
 }
Beispiel #3
0
 public virtual bool CanTake(ItemBase it) => IsEmpty() || item.GetType() == it?.GetType();
Beispiel #4
0
 public override bool CanTake(ItemBase it) => HandItem is null || it?.GetType() == HandItem.GetType();