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

public class EventManager : MonoBehaviour {

	#region variables
	protected List <EventTile> _events;
	#endregion

	#region events
	void Awake () {

		_events = new List <EventTile> ();
		int count = transform.childCount;

		for (int i = 0; i < count; ++i) {
			EventTile et = transform.GetChild (i).GetComponent <EventTile> ();

			et.SetEventManager (this);

			if (i != 0) et.gameObject.SetActive (false);

			_events.Add (et);

		}

	}
	#endregion


	#region methods
	public void Next () {

		DestroyImmediate (_events[0].gameObject);
		_events.RemoveAt (0);

		if (_events.Count > 0) {
			_events[0].gameObject.SetActive (true);
		}
		
	}
	#endregion
	
}
