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

public class LoadALevel : MonoBehaviour {

	public GameObject esirA;
	public GameObject esir;
	public int whichLevel=2;
	// Level 1 is credits, Level 2 is first level


	
	// Update is called once per frame
	void Update () {
	
	}

	void OnTriggerEnter2D(Collider2D other) {
		if (other.tag == "Player") {
			Invoke ("LoadLateLevel", 1.5f);

			if (esirA != null && esir != null) {
				esirA.SetActive (true);
				esir.SetActive (false);
			}
		}


	}

	void LoadLateLevel()
	{
		if (whichLevel == 2) {

				
			SceneManager.LoadScene ("1Level");
		}
			

		else if (whichLevel==1)
			SceneManager.LoadScene ("Credits");
	}
}
