using UnityEngine;
using System.Collections;

public class Victory : MonoBehaviour
{
	public float respawnDelay;

	public GameObject enemy;

	public string level;

	// Use this for initialization
	void Start ()
	{

	}

	// Update is called once per frame
	void Update ()
	{
		if (enemy == null)
		{
			YouWin ();
		}
	}

	public void YouWin()
	{
		StartCoroutine("YouWinCo");
	}

	public IEnumerator YouWinCo()
	{
		yield return new WaitForSeconds(respawnDelay);
		Application.LoadLevel(level);
	}
}
