using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;

public class MainMenuController : MonoBehaviour {


    public GameObject mainMenu, creditsMenu;
    public GameObject startGameButton, creditsMenuButton;
    public EventSystem eSystem;

    private void Start()
    {
        GameObject.FindGameObjectWithTag("SceneFader").GetComponent<SceneFader>().FadeScene(FadeState.FadeOut, null);
    }

    private void ChangeScene ()
    {
        SceneManager.LoadScene("Controls");
    }

    public void StartClicked ()
    {
        GameObject.FindGameObjectWithTag("SceneFader").GetComponent<SceneFader>().FadeScene(FadeState.FadeIn, ChangeScene);
    }

    public void ToggleCredits() {
        mainMenu.SetActive(!mainMenu.activeSelf);
        creditsMenu.SetActive(!creditsMenu.activeSelf);
        if (mainMenu.activeSelf) {
            eSystem.SetSelectedGameObject(startGameButton);
        }
        else {
            eSystem.SetSelectedGameObject(creditsMenuButton);
        }
    }

}
