Esempio n. 1
0
    private void GenerateShop()
    {
        for (int i = 0; i < shopItems.Length; i++)
        {
            GameObject newButton = Instantiate(buttonTemplate) as GameObject;
            newButton.SetActive(true);

            ShopButton shopButton = newButton.GetComponent <ShopButton>();
            shopButton.SetIcon(shopItems[i].itemIcon);
            shopButton.SetName(shopItems[i].itemName);
            shopButton.SetPrice(shopItems[i].itemPrice);
            shopButton.SetPrefab(shopItems[i].itemPrefab);
            shopButton.CreditManager = creditManager.GetComponent <CreditManager>();
            shopButton.ShopHandler   = this;
            shopButton.Item          = shopItems[i];
            newButton.transform.SetParent(buttonTemplate.transform.parent, false);
        }

        if (toolTip != null)
        {
            toolTipHandler = toolTip.GetComponent <ToolTipHandler>();
        }
    }