예제 #1
0
 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);
 }
예제 #2
0
    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);
        }
    }
예제 #3
0
    public void SetItem(EnumItemID itemId)
    {
        ItemId = itemId;
        if (!Statics.AllInventoryItems.TryGetValue(itemId, out itemInfo))
            return;

        GetComponent<Image>().sprite = itemInfo.ItemSprite;
        Name = itemInfo.ItemName;
    }
예제 #4
0
 public void AddInventoryItem(EnumItemID toAdd)
 {
     Statics.Inventory.Add(Statics.AllInventoryItems[toAdd]);
     FindObjectOfType<InventoryController>().UpdateInventory();
 }
예제 #5
0
 internal void RemoveInventoryItem(EnumItemID itemID)
 {
     var item = Statics.AllInventoryItems[itemID];
     Statics.Inventory.Remove(item);
     FindObjectOfType<InventoryController>().UpdateInventory();
 }
예제 #6
0
 public bool HasInventoryItem(EnumItemID itemID)
 {
     return Statics.Inventory.Any(e => e.ItemID == itemID);
 }