Exemple #1
0
    private void Start()
    {
        uiManager   = UIManager.Instance;
        playerStats = PlayerManager.Instance.playerStats;
        playerStats.OnCraftingSkilledUp += UpdateCraftingSkillText;

        List <Item> craftableItems = GameManager.Instance.GetCraftableItems();

        craftableItems.Sort((x, y) => x.craftingSkillRequired.CompareTo(y.craftingSkillRequired));

        foreach (Item item in craftableItems)
        {
            GameObject     newItemButton = Instantiate(itemButton, itemButtonSpacer1, false);
            CraftingButton cButton       = newItemButton.GetComponent <CraftingButton>();
            cButton.SetItem(item);
            cButtons.Add(cButton);
        }
        craftingUI.SetActive(false);
        ResetCraftingUI();
    }
Exemple #2
0
    public void SetCraftItemButton(Item item)
    {
        ResetButtonSprites();
        ClearItemObjects();
        uiManager.PlaySelectSound();
        craftButton.gameObject.SetActive(true);
        craftButton.SetItem(item, false);
        youWillCreateText.enabled = true;
        itemName.text             = item.itemName;
        itemDescription.text      = GetItemCraftingRequirements(item);

        foreach (Transform itemIconObject in itemIconSpacer)
        {
            if (!itemIconObject.gameObject.activeInHierarchy)
            {
                itemIconObject.GetComponent <QuestRewardItemSlot>().AddItem(item);
                itemIconObjects.Add(itemIconObject.gameObject);
                break;
            }
        }
    }