using UnityEngine;
using System.Collections;

public class SplashScript : MonoBehaviour {
    private int state;

    public GameObject splash = null;
    public GameObject subtitles = null;

    private float counter;
    public float speed = 0.3f;

    public float finalY = 850;

	// Use this for initialization
	void Start () {
        state = 0;
	}
	
	// Update is called once per frame
    void Update()
    {
        if (state == 1)
        {
            if (subtitles.transform.localPosition.y < finalY)
            {
                subtitles.transform.position += new Vector3(0, Time.deltaTime * speed, 0);
            }
        }

        if ((Input.GetKeyUp(KeyCode.Escape) || Input.GetKeyUp(KeyCode.Return)))
        {
            switch (state)
            {
                case 0:
                    splash.SetActive(false);
                    subtitles.SetActive(true);
                    break;
                case 1:
                    break;
                default:
                    break;
            }

            state++;
            if (state == 2)
            {
                Application.LoadLevel("Gameplay");
            }
        }
	}
}
