Пример #1
0
    public static void UpdateResourceCount(string resourceName, int updateAmount)
    {
        Item toUpdate = ItemMasterlist.GetItem(resourceName);

        if (toUpdate.itemType != "tool")
        {
            resources[resourceName] += updateAmount;
        }
    }
Пример #2
0
    public static void SelectResultItem()
    {
        //based on the item name from the shown button, increment the item count in inventory
        string itemName = Crafting.uiEventSystem.currentSelectedGameObject.name;

        Inventory.UpdateResourceCount(itemName, 1);
        Debug.Log("Received Item! Total " + itemName + " :" + Inventory.GetResourceCount(itemName));

        //for each string in item.requirements, decrement inventory item by 1
        Item selected = ItemMasterlist.GetItem(itemName);

        foreach (string req in selected.requirements)
        {
            Debug.Log("Requirement: " + req);
            Inventory.UpdateResourceCount(req, -1);
        }

        //after player takes item, clear currentlyCrafting list
        ClearResults();
        ClearOutlines();
        Instance.selections.text = "";
        Inventory.currentlyCrafting.Clear();
    }