using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class StartGameTimerUI : MonoBehaviour {

	private StartGameTimer objGameTimer;

	public Text gameTimerUI_txt;



	void Awake()
	{
		objGameTimer = GetComponent<StartGameTimer>();
	}

	void OnEnable()
	{
		EventManager.StartListening(Constants.START_GAME, DisableTimer);
		
	}

	void OnDisable()
	{

		EventManager.StopListening(Constants.START_GAME, DisableTimer);
	}

	// Update is called once per frame
	void Update () {
		int timer = (int)objGameTimer.timer;
		gameTimerUI_txt.text = timer.ToString();
		
	}

	void DisableTimer()
	{
		gameTimerUI_txt.gameObject.SetActive(false);
		gameObject.SetActive(false);
	}
	
}
