using System.Collections.Generic;
using UnityEngine;

public class MenuController : MonoBehaviour
{
    public List<MenuScreen> screens;

    public void ShowScreen(string screenName)
    {
        HideAllScreens();
        
        MenuScreen selScreen = screens.Find(x => x.screenName == screenName);
        if (selScreen != null)
        {
            selScreen.Show();
        }
        else
        {
            throw new System.Exception("Screen name was not found in list of screens!");
        }
    }

    public void HideAllScreens()
    {
        foreach (var screen in screens)
        {
            screen.Hide();
        }
    }
}
