using UnityEngine;
using System.Collections;

public class OutroScript : MonoBehaviour {
    private int state;

    public GameObject subtitles = null;

    private float counter;

	    public float speed = 0.3f;

    public float finalY = 850;

	// Use this for initialization
	void Start () {
        state = 0;

        UILabel label = subtitles.GetComponent<UILabel>();

//        if (false) // 0 deaths
//        {
//            label.text = "Congratulations\n\nYou escaped without dying.\n\nDid you cheated?\n\n Enter to exit / R to restart.";
//        }
//        else
//        {
//            label.text = "Congratulations\n\nYou escaped and in progress you killed " 
//                + "x" 
//                + " people.\n\nWhat do we do now?\n\nBeating record killing more?\n\nEnter to exit / R to restart";
//        }
	}
	
	// Update is called once per frame
    void Update()
    {
        if (Input.GetKeyUp(KeyCode.R))
        {
            Application.LoadLevel("Gameplay");
        }

        if ((Input.GetKeyUp(KeyCode.Escape) || Input.GetKeyUp(KeyCode.Return)))
        {
            switch (state)
            {
                case 0:
                    //UILabel label = subtitles.GetComponent<UILabel>();
                    //label.text = "Created by:\n\n Czajkowski Bartosz\n\n Falkowski Andrzej\n\n Prymas Marcin\n\n\n Enter to exit.";

                    break;
                case 1:
                    Application.Quit();
                    break;
                default:
                    break;
            }

            state++;
        }

		if (subtitles.transform.localPosition.y < finalY) 
		{
						subtitles.transform.position += new Vector3 (0, Time.deltaTime * speed, 0);
		} 
		else 
		{
			Application.Quit();
		}
	}
}
