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

public class EndGame : MonoBehaviour {
    public float TimeSurvived = 0f;
	// Use this for initialization
	void Start () {
        TimeSurvived = GameObject.FindGameObjectWithTag("Butcher").GetComponent<GameStatus>().TimeSurvived = Time.timeSinceLevelLoad;
        foreach (Text T in GameObject.FindObjectsOfType<Text>())
        {
            if (T.gameObject.name == "txtSurvive")
                T.text += String.Format("{0:0}:{1:00}", Mathf.Floor(TimeSurvived/60), TimeSurvived % 60);
        }
	
	}
	
	// Update is called once per frame
	void Update () {
        if (Input.GetKeyDown(KeyCode.Return))
            SceneManager.LoadScene(0);
        else if (Input.GetKeyDown(KeyCode.Escape))
            Application.Quit();
	}
}
