edx/assignment8final/Assets/Resources/Scripts/CoinText.cs
2022-11-10 21:56:29 -03:00

25 lines
489 B
C#

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
[RequireComponent(typeof(Text))]
public class CoinText : MonoBehaviour {
public GameObject helicopter;
private Text text;
private int coins;
// Use this for initialization
void Start () {
text = GetComponent<Text>();
}
// Update is called once per frame
void Update () {
if (helicopter != null) {
coins = helicopter.GetComponent<HeliController>().coinTotal;
}
text.text = "Coins: " + coins;
}
}