using UnityEngine;
using System.Collections;

public class DoorOpener : MonoBehaviour
{

		public GameObject closedDoor;
		

		void OnTriggerEnter (Collider coll)
		{
				if (coll.tag == "Player" && KeyManager.key.openDoorOk ()) {
						GameObject.Destroy (closedDoor);

					StartCoroutine (WaitForRestart ());

						

				}

			
		}

	IEnumerator WaitForRestart ()
	{
		yield return new WaitForSeconds (3);

		Application.LoadLevel ("EndSceneFINAL");
		
	} 
}