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

public class CanvasController : MonoBehaviour {

	#region variables
	[SerializeField]
	private Dictionary <string, GameObject> _panels;
	#endregion


	#region events
	void Awake () {

		_panels = new Dictionary <string, GameObject> ();
		GameObject[] e = GameObject.FindGameObjectsWithTag ("Canvas_Dynamic");
		foreach (GameObject g in e) {
			_panels.Add (g.name, g);
			g.SetActive (false);
		}

	}
	#endregion


	#region Methods
	public void SetPanel (string panel, bool show) {
		
		_panels[panel].SetActive (show);
		
	}

	public GameObject GetPanel (string panel) {

		if (_panels.ContainsKey (panel))
			return _panels[panel];

		return null;
		
	}
	#endregion

}
