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

public class StartCountDown : MonoBehaviour {
	public int startCountDown;
	public Text countDownTxt;
	public GameObject mainCountDown;
	public GameObject countDownPanel;
	public PlayerMoviment[] players;
	// Use this for initialization
	void Start () {
		mainCountDown.SetActive (false);
	}
	
	// Update is called once per frame
	void Update () {
		float remainingTime = startCountDown - Time.timeSinceLevelLoad;
		int remaininIntTime = (int)remainingTime;
		if (remainingTime > 1)
			countDownTxt.text = remaininIntTime.ToString ();
		else if (remainingTime > 0)
			countDownTxt.text = "Escape!";
		else {
			foreach(PlayerMoviment player in players){
				player.canMove = true;
			}
			countDownPanel.SetActive (false);
			mainCountDown.SetActive (true);
		}
	}
}
