示例#1
0
 public bool AddObject(Item item, int amount)
 {
     DeterminateNextEmptySpace();
     if (((item.apilable && !objects.Contains(item)) && !inventoryFull) || (!item.apilable && !inventoryFull))
     {
         Space addSpace = spaces[emptySpace];
         objects.Add(item);
         addSpace.AddObject(item, amount);
         return(true);
     }
     if (item.apilable && objects.Contains(item))
     {
         for (int index = 0; index < spaces.Length; index++)
         {
             if (item == spaces[index].saveItem)
             {
                 spaces[index].amountStock += amount;
                 break;
             }
         }
         return(true);
     }
     Debug.Log("Inventory is full");
     return(false);
 }