using UnityEngine;
using System.Collections;

public class Gun : MonoBehaviour {
	
	public AudioClip gunshot;

	void Use ()
	{	
		StartCoroutine(EndGame ());
	}

	IEnumerator EndGame ()
	{
		transform.tag = "Untagged";
		StartCoroutine(GameObject.Find("Fader").GetComponent<SceneFader>().FadeToBlack());
		yield return new WaitForSeconds(3f);
		AudioSource.PlayClipAtPoint(gunshot, transform.position);
		yield return new WaitForSeconds(4f);
		Application.LoadLevel (Application.loadedLevelName);
	}
}
