using UnityEngine;
using System.Collections;
using Util;

namespace Alcatraz
{
	public class TitleManager : MonoBehaviour
	{
		public float delayLoadTime = 1f;
		public string titleBgmName;

		void Start() {
			SoundManager.GetInstance ().PlayBGM (titleBgmName);
		}

		public void GoToMain () {
			StartCoroutine (WaitAndLoadMainScene());
		}

		IEnumerator  WaitAndLoadMainScene() {
			// TODO: FadeOut before load next scene
			yield return new WaitForSeconds (delayLoadTime);
			Application.LoadLevel ("Main");
		}

		void OnDestroy(){
			SoundManager.GetInstance ().StopBGM ();
		}
	}
}