Exemple #1
0
    void CreateItemList()
    {
        int playerFunds = GetPlayerMoney();

        foreach (Item i in itemsForSale)
        {
            ShopItemUIEntry uiEntry = GameObject.Instantiate(shopItemUIEntryTemplate, itemsHolder.transform).GetComponent <ShopItemUIEntry>();
            uiEntry.Initialize(i);
            //uiEntry.gameObject.transform.parent = itemsHolder.transform;
        }
    }
Exemple #2
0
    public void SelectItem(Item item, ShopItemUIEntry uiEntry)
    {
        selectedItem             = item;
        itemDescriptionText.text = item.description;

        // mark the last selected UI entry as not selected so the image stops bouncing
        if (selectedUIEntry)
        {
            selectedUIEntry.isSelected = false;
        }
        selectedUIEntry            = uiEntry;
        selectedUIEntry.isSelected = true;

        buyButton.gameObject.SetActive(item != null);
    }
Exemple #3
0
    void CreateItemList()
    {
        foreach (Transform child in itemsHolder.transform)
        {
            Destroy(child.gameObject);
        }

        int playerFunds = GetPlayerMoney();

        foreach (Item i in itemsForSale)
        {
            if (i == null)
            {
                Debug.LogError("Null Item!");
            }
            else if (i.CanBeBought())     // IF i IS NULL, UNITY CRASHES
            {
                ShopItemUIEntry uiEntry = GameObject.Instantiate(shopItemUIEntryTemplate, itemsHolder.transform).GetComponent <ShopItemUIEntry>();
                uiEntry.Initialize(i);
            }
            //uiEntry.gameObject.transform.parent = itemsHolder.transform;
        }
    }