Example #1
0
    void updateFortuneInfo()
    {
        foreach (GameObject fortuneObj in fortuneObjPool)
        {
            Fortune fortune = fortuneObj.GetComponent <FortuneObject>().fortune;
            if (fortune.isAvailable)
            {
                fortune.updatePrice();                                                      // Update price
                fortuneObj.GetComponentInChildren <Text>().text = fortune.getDescription(); // Update description

                fortuneObj.SetActive(true);
                // Make buyable/unbuyable
                bool isBuyable = (Player.experience >= fortune.priceToNextLevel);
                fortuneObj.GetComponent <Button>().interactable = isBuyable;

                // Show/Hide 'NEW' icon
                GameObject newText = fortuneObj.transform.GetChild(1).gameObject;
                newText.SetActive(fortune.isNew);
            }
        }
    }