using UnityEngine;
using System.Collections;

public class disasterSpawner : MonoBehaviour {

	public AudioClip priestSpawn;
	public AudioClip pureNoise;
	public AudioClip babyNoise;

	public GameObject holyOne;
	public GameObject pureOne;
	public GameObject baby;

	public Transform holySpawn;
	public Transform pureSpawn;
	public Transform babySpawn;

	public float holyTime;
	public float pureTime;
	public float babyTime;

	private bool holyBool;
	private bool pureBool;
	private bool babyBool;

	public gameController gm;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if (gm.currentTime <= holyTime && gm.currentTime >= holyTime - 1 && holyBool == false) {
			AudioSource.PlayClipAtPoint (priestSpawn, transform.position);
			Instantiate (holyOne, holySpawn.position, holySpawn.rotation);
			holyBool = true;
		} else if (gm.currentTime <= pureTime && gm.currentTime >= pureTime - 1 && pureBool == false) {
			AudioSource.PlayClipAtPoint (pureNoise, transform.position);
			Instantiate (pureOne, pureSpawn.position, pureSpawn.rotation);
			pureBool = true;
		} else if (gm.currentTime <= babyTime && gm.currentTime >= babyTime - 1 && babyBool == false) {
			AudioSource.PlayClipAtPoint (babyNoise, transform.position);
			Instantiate (baby, babySpawn.position, babySpawn.rotation);
			babyBool = true;
		}
	}
}
