Пример #1
0
 public void FindItemInInventoryAndRemove(Item item)
 {
     //called from EquipScreen and other screens where inventory items may show up
     //This is for those screens to find the item that corresponds to the item that is in their inventory
     //So it finds the item in its slot and finds the item in a slot in the inventory then removes it
     foreach (InventorySlots slots in slotList)
     {
         InventorySlots thisSlot = slots.GetComponent <InventorySlots>();
         if (thisSlot == null)
         {
             // Debug.Log("thisSlot is null");
         }
         // Debug.Log("thisSlot comes from: " + thisSlot.transform.parent.name);
         if (thisSlot.MyItem == item)
         {
             Debug.Log("The item that was in this slot has been found in the inventory and will be removed now");
             thisSlot.RemoveItem(item);
             break;
         }
     }
 }