Last active
March 13, 2018 23:30
-
-
Save giljr/5266281c2966df36bb90facd3eddb98a to your computer and use it in GitHub Desktop.
Episode#10 Unity Game
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.UI; | |
public class HUD : MonoBehaviour { | |
public Text mTxtHealth; | |
public Text mTxtTime; | |
public RectTransform mPanelGameOver; | |
public Text mTxtGameOver; | |
// Use this for initialization | |
void Start () | |
{ | |
GameController.Instance.GameOverEvent += OnGameOverEvent; | |
} | |
private void OnGameOverEvent (object sender, System.EventArgs e) | |
{ | |
mPanelGameOver.gameObject.SetActive(true); | |
mTxtGameOver.text = GameController.Instance.IsWon ? "YOU WON" : "YOU LOOSE"; | |
} | |
// Update is called once per frame | |
void Update () { | |
mTxtHealth.text = GameController.Instance.Health.ToString(); | |
mTxtTime.text = GameController.Instance.Time.ToString(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment