var messages : String[];

var sendDelay : float = 3.0;
var destroyOnSent : boolean = true;
var sendAllOnTrigger : boolean = true;

private var counter : int = 0;

collider.isTrigger = true;

function OnTriggerEnter(col : Collider){
	if(col.gameObject.CompareTag("Player")){
		if(!sendAllOnTrigger){
			GameObject.FindWithTag("GameController").GetComponent(LevelController).TriggerTutorial(messages[counter]);
			counter++;
		} else {
			SendAll();
		}
		if(destroyOnSent)
			Destroy(collider);
	}
}

function OnColliderEnter(col : Collider){
	if(col.gameObject.CompareTag("Player")){
		if(!sendAllOnTrigger){
			GameObject.FindWithTag("GameController").GetComponent(LevelController).TriggerTutorial(messages[counter]);
			counter++;
		} else {
			SendAll();
		}
		if(destroyOnSent)
			Destroy(collider);
	}
}

function SendAll() {
	counter = 0;
	while(counter < messages.length){
		GameObject.FindWithTag("GameController").GetComponent(LevelController).TriggerTutorial(messages[counter]);
		counter++;
		yield WaitForSeconds(sendDelay);
		GameObject.FindWithTag("GameController").GetComponent(LevelController).TriggerTutorial(" ");
	}
	if(destroyOnSent)
		Destroy(gameObject);
}