public InventoryItem(string ItemName, string ItemDescription, EnumItemID ItemID, string spritePath, string spritePathDir = "InventoryIcons/") { this.ItemName = ItemName; this.ItemDescription = ItemDescription; this.ItemID = ItemID; ItemSprite = Resources.Load<Sprite>(spritePathDir + spritePath); }
internal void Use(EnumItemID itemId) { var used = false; foreach (var action in UseActions.Where(action => action != null && action.isActiveAndEnabled && action.itemID == itemId)) { action.Use(); used = true; break; } if (!used) { if (string.IsNullOrEmpty(DialogNo)) DialogController.Instance.ShowRandomDialog(); else DialogController.Instance.ShowDialog(DialogController.Instance.GetDialog(DialogNo), GetComponent<DialogActor>().Avatar); } }
public void SetItem(EnumItemID itemId) { ItemId = itemId; if (!Statics.AllInventoryItems.TryGetValue(itemId, out itemInfo)) return; GetComponent<Image>().sprite = itemInfo.ItemSprite; Name = itemInfo.ItemName; }
public void AddInventoryItem(EnumItemID toAdd) { Statics.Inventory.Add(Statics.AllInventoryItems[toAdd]); FindObjectOfType<InventoryController>().UpdateInventory(); }
internal void RemoveInventoryItem(EnumItemID itemID) { var item = Statics.AllInventoryItems[itemID]; Statics.Inventory.Remove(item); FindObjectOfType<InventoryController>().UpdateInventory(); }
public bool HasInventoryItem(EnumItemID itemID) { return Statics.Inventory.Any(e => e.ItemID == itemID); }