Beispiel #1
0
 public void InventoryAddItem(SOInventoryItem item)
 {
     if (InventoryCanPickUpItem(item))
     {
         InventoryItems.Add(item);
         InventoryRedrawItems();
     }
 }
Beispiel #2
0
 public void InventoryRemoveItem(SOInventoryItem item)
 {
     if (InventoryHasItem(item))
     {
         InventoryItemsArchive.Add(item);
         InventoryItems.Remove(item);
         InventoryRedrawItems();
     }
 }
Beispiel #3
0
    public static SOInventoryItem Load(string name)
    {
        SOInventoryItem item = Resources.Load <SOInventoryItem>("Items/" + name);

        if (!item)
        {
            Debug.LogError("SOInventoryItem failed:" + name);
        }
        return(item);
    }
Beispiel #4
0
 public bool InventoryArchiveHasItem(SOInventoryItem item)
 {
     return(InventoryItemsArchive.Exists(i => i.Equals(item)));
 }
Beispiel #5
0
 public bool InventoryHasItemNamed(string itemName)
 {
     return(InventoryHasItem(SOInventoryItem.Load(itemName)));
 }
Beispiel #6
0
 public bool InventoryHasItem(SOInventoryItem item)
 {
     return(InventoryItems.Exists(i => i.Equals(item)));
 }
Beispiel #7
0
 public bool InventoryIsHoldingItem(SOInventoryItem item)
 {
     return(InventoryHeldItem && InventoryHeldItem.name.Equals(item.name));
 }
Beispiel #8
0
 public void InventoryAddItem(string itemName)
 {
     InventoryAddItem(SOInventoryItem.Load(itemName));
 }
Beispiel #9
0
 public bool InventoryCanPickUpItem(SOInventoryItem item)
 {
     return(!InventoryHasItem(item) && !InventoryArchiveHasItem(item));
 }