using UnityEngine;
using System.Collections.Generic;

public class MenuMng : MonoBehaviour 
{
	public GameObject[] MenuObjects;

	Dictionary<string, GameObject> menuBank;

	GameObject currentMenu;

	int var;
	void Start ()
	{
		menuBank = new Dictionary<string, GameObject>();
		for (int i = 0; i < MenuObjects.Length; i++)
		{
			menuBank.Add(MenuObjects[i].name, MenuObjects[i]);
			MenuObjects[i].SetActive(false);
		}

	}

	void ShowMenu(string MenuName)
	{
		if(currentMenu != null) {
			currentMenu.SetActive(false);
		}
		if(menuBank.ContainsKey(MenuName)){
			currentMenu = menuBank[MenuName];
			currentMenu.SetActive(true);
		}
		else {
			Debug.LogWarning("Menu name not valid");
		}
	}
}
