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

public class scrStartGame : MonoBehaviour {

	public CanvasGroup cg;
	public GameObject goButtonStart;
	public GameObject goButtonInfo;
	public GameObject goLoading;
	public Image img;

	public void LoadScene(string sc01)
	{
		StartCoroutine(doLoadScene(sc01));
	}

	IEnumerator doLoadScene(string sc01) {

		cg.interactable = false;
		goButtonStart.SetActive(false);
		goButtonInfo.SetActive(false);
		img.gameObject.SetActive(true);
		goLoading.SetActive(true);

		Color _color = img.color;

		while ( img.color.a < .99f ) {

			GetComponent<AudioSource>().volume -= Time.deltaTime;

			_color.a += Time.deltaTime *.5f;
			img.color = _color;

			yield return 0;

		}

		_color.a = 1.0f;
		img.color = _color;

		Application.LoadLevel (sc01);
	}

}


