using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class IdeaQueue : MonoBehaviour {

	private Queue<Thinkie> q;

	private float frequency;
	private float countdown;

	void Start(){
		q = new Queue<Thinkie> ();
		countdown = 0.0f;
		frequency = Constants.QUEUE_FREQUENCY;
	}

	void FixedUpdate () {
		if(q.Count != 0){
			if(countdown < frequency){
				countdown += Time.deltaTime;
			} else {
				countdown = 0.0f;
				Thinkie t = q.Dequeue();
				t.GoToExit();
			}
		}
	}

	public void pushToQueue(Thinkie t){
		q.Enqueue (t);
	}
}
