using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class Buttons : MonoBehaviour {


	public Light spotLight;

	public float minLightAngle;
	public float maxLightAngle;
	public float seenTime = 1f;

	public void playButton()
	{
		StartCoroutine(playEnum());
		GameObject.Find("Canvas/Button").SetActive(false);

	}
		

	IEnumerator playEnum()
	{
		spotLight.spotAngle = maxLightAngle;
		float t = 0f;
		while(t < 1)
		{
			t += Time.deltaTime / seenTime;
			spotLight.spotAngle = Mathf.Lerp(maxLightAngle, 1f , t);
			yield return null;
		}
		spotLight.spotAngle = 1f;
		t = 0f;
		while(t < 1)
		{
			t += Time.deltaTime / seenTime;
			spotLight.spotAngle = Mathf.Lerp(1f, minLightAngle , t);
			yield return null;
		}
		spotLight.spotAngle = minLightAngle;
		yield return new WaitForSeconds(0.35f);
		SceneManager.LoadScene("Main");
	}
}
