using UnityEngine;
using UnityEngine.SceneManagement;

public class MenuManager : MonoBehaviour
{
    public GameObject MainMenuPanel;
    public GameObject SettingsPanel;

    public void StartNewGame()
    {
        WorldSettings.generateNewWorld = true;
        WorldSettings.seed = Random.Range(int.MinValue, int.MaxValue);

        LoadingManager.sceneToLoad = "Game";
        LoadingManager.loadSave = false;  // No loading for new game

        SceneManager.LoadScene("LoadingScreen");
    }

    public void LoadGame()
    {
        WorldSettings.generateNewWorld = false;

        LoadingManager.sceneToLoad = "Game";
        LoadingManager.loadSave = true; // load the last save

        SceneManager.LoadScene("LoadingScreen");
    }




    public void OpenSettings()
    {
        if (SettingsPanel != null)
        {
            MainMenuPanel.SetActive(false);
            SettingsPanel.SetActive(true);
        }
    }

    public void CloseSettings()
    {
        if (SettingsPanel != null)
        {
            SettingsPanel.SetActive(false);
            MainMenuPanel.SetActive(true);
        }
    }

    public void QuitGame()
    {
        Application.Quit();
        Debug.Log("Quit Game.");
    }

}
