Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using UnityEngine.UI;
- public class HUD : MonoBehaviour {
- public static HUD instance;
- Text healthText;
- void Awake () {
- if(instance == null)
- {
- instance = this;
- healthText = transform.Find("HealthText").GetComponent<Text>();
- GetComponentInChildren<Camera>().gameObject.SetActive(false);
- }
- else
- {
- DestroyImmediate(gameObject);
- return;
- }
- }
- public void DisplayHealth(int health)
- {
- healthText.text = string.Format("Health: {0}", health);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement