Beispiel #1
0
    public void UseItem(ItemBaseInfo.ItemType itemType, Item itemToUse)
    {
        switch (itemType)
        {
        case ItemBaseInfo.ItemType.Consumable:

            break;

        case ItemBaseInfo.ItemType.Weapon:

            break;

        case ItemBaseInfo.ItemType.Armor:

            break;

        case ItemBaseInfo.ItemType.Placeable:

            break;

        case ItemBaseInfo.ItemType.Resource:

            break;
        }
    }
    private void PopulatePanelData(ItemBaseInfo.ItemType itemType, Item curHeldItem)
    {
        switch (itemType)
        {
        case ItemBaseInfo.ItemType.Consumable:

            ItemNameText.text               = curHeldItem.ItemBaseInfo.ItemName;
            EatFoodItemSprite.sprite        = curHeldItem.ItemBaseInfo.ItemSprite;
            EatFoodItemInfoText.text        = curHeldItem.ItemBaseInfo.ItemDescription;
            EatFoodHealingAmountText.text   = "+" + curHeldItem.ItemTypeInfo.GetType().GetField("GiveHealthAmount").GetValue(curHeldItem.ItemTypeInfo);
            EatFoodCaloriesAmountText.text  = "+" + curHeldItem.ItemTypeInfo.GetType().GetField("GiveCaloriesAmount").GetValue(curHeldItem.ItemTypeInfo);
            EatFoodHydrationAmountText.text = "+" + curHeldItem.ItemTypeInfo.GetType().GetField("GiveHydrationAmount").GetValue(curHeldItem.ItemTypeInfo);

            EatFoodButton.onClick.AddListener(() => InventoryManager.Instance.UseItem(itemType, curHeldItem));
            DropFoodButton.onClick.AddListener(() => InventoryManager.Instance.DropItem());
            Debug.Log("Populating Consumable Type Info Panel");

            break;

        case ItemBaseInfo.ItemType.Weapon:

            Debug.Log("Populating Weapon Type Info Panel");
            break;

        case ItemBaseInfo.ItemType.Armor:

            Debug.Log("Populating Armor Type Info Panel");
            break;

        case ItemBaseInfo.ItemType.Placeable:

            Debug.Log("Populating Placeable Type Info Panel");
            break;

        case ItemBaseInfo.ItemType.Resource:

            Debug.Log("Populating Resource Type Info Panel");
            break;

        default:
            ResetAllPanels();

            break;
        }
    }