Пример #1
0
        // Called when the highlighted character is changed to update all the UI info about the new character
        private void UpdateUI()
        {
            coinsText.text       = CoinsCollected.ToString();
            nameText.text        = characterSetup[highlightedCharacterIndex].name;
            descriptionText.text = characterSetup[highlightedCharacterIndex].description + "\n";
            descriptionText.rectTransform.anchoredPosition = Vector2.zero;
            descriptionText.fontSize = descriptionTextSize * (Screen.height / 100);

            // If the character is already bought we show the "Select" button
            if (IsHighlightedCharacterUnlocked())
            {
                selectButton.SetActive(true);
                buyButton.SetActive(false);
            }
            // If not we show the "Buy" button
            else
            {
                selectButton.SetActive(false);
                buyButton.SetActive(true);
                priceText.text = characterSetup[highlightedCharacterIndex].price.ToString();
            }
        }
Пример #2
0
 // Start is called before the first frame update
 void Start()
 {
     publicCoinsText      = GetComponent <Text>();
     coinsCollectedScript = FindObjectOfType <CoinsCollected>();
 }