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


public class RestartLevel : MonoBehaviour {

    public float delay = 2f;
    public string SceneToLoad;
	void Start () {
        NotificationCenter.DefaultCenter().AddObserver(this, "PlayerIsDead");
	}
    void PlayerIsDead(Notification notificacion)
    {
       
        StartCoroutine(restartLevel());
    }
	// Update is called once per frame
    IEnumerator restartLevel()
    {
        yield return new WaitForSeconds(delay);
        SceneManager.LoadScene(SceneToLoad);
    }
}       
