using UnityEngine;
using UnityEngine.SceneManagement;
using DG.Tweening;

public class TitleKeyCheck : MonoBehaviour
{
	public string SceneToLoad = "PlayScene";
	private float startTime;

	void Update()
    {
		if (Time.time < startTime + 0.8f)  // no instapress accidental skip
			return;

		if (Input.GetKey(KeyCode.W) || 
			Input.GetKey(KeyCode.Z) || 
			Input.GetKey(KeyCode.UpArrow) ||
			Input.GetKey(KeyCode.S) || 
			Input.GetKey(KeyCode.DownArrow) ||
			Input.GetKey(KeyCode.D) || 
			Input.GetKey(KeyCode.RightArrow) ||
			Input.GetKey(KeyCode.A) || 
			Input.GetKey(KeyCode.Q) || 
			Input.GetKey(KeyCode.LeftArrow) ||
			Input.GetKey(KeyCode.Space)
			)
		{
			StartGame();
		}
	}

	private void Start()
	{
		startTime = Time.time;
	}

	private void StartGame()
	{
		DOTween.KillAll();
		SceneManager.LoadScene(SceneToLoad);
	}
}
