Beispiel #1
0
    void InstantiateSalesItems()
    {
        GrottoSpawnPoint gsp = GrottoSpawnPoint;

        for (int i = 0; i < gsp.SaleItemPrefabs.Count; i++)
        {
            Collectible  cPrefab = gsp.SaleItemPrefabs[i];
            SaleItemView v       = _saleItemViews[i];   // TODO: Instantiate these dynamically

            if (cPrefab == null || v == null)
            {
                continue;
            }

            cPrefab.riseUpWhenCollected = false;

            int price = gsp.SaleItemPrices[i];

            string cName = cPrefab.itemPrefab.name;
            Item   item  = Inventory.Instance.GetItem(cName);
            if (!item.IsMaxedOut)
            {
                Collectible c = Grotto.InstantiateItem(cPrefab.gameObject, v.transform, price);
                c.name = cName;
                _salesItems.Add(c);
            }

            string priceText = price.ToString();
            v.UpdatePriceText(priceText);
            v.gameObject.SetActive(!item.IsMaxedOut);
        }
    }
Beispiel #2
0
    void ShowTheShopItems(bool doShow = true)
    {
        if (_salesItems.Count == 0)
        {
            InstantiateSalesItems();
        }

        for (int i = 0; i < _salesItems.Count; i++)
        {
            Collectible  c = _salesItems[i];
            SaleItemView v = _saleItemViews[i];         // TODO: Instantiate these dynamically

            if (c == null || v == null)
            {
                continue;
            }

            Item item = Inventory.Instance.GetItem(c.name);
            v.gameObject.SetActive(doShow && !item.IsMaxedOut);
        }

        _rupeePriceSymbol.SetActive(doShow);

        return;
    }