using UnityEngine;
using System.Collections;

public class ReloadLevel : MonoBehaviour
{

	public float respawnDelay;

	public GameObject player1;

	public GameObject player2;

	// Use this for initialization
	void Start ()
	{
	
	}
	
	// Update is called once per frame
	void Update ()
	{
		if (player1 == null && player2 == null)
		{
			RespawnPlayer ();
		}
	}

	public void RespawnPlayer()
	{
		StartCoroutine("RespawnPlayerCo");
	}
		
	public IEnumerator RespawnPlayerCo()
	{
		yield return new WaitForSeconds(respawnDelay);
		Application.LoadLevel(Application.loadedLevel);
	}
}
