2023-11-02 12:25:50 +01:00
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.SceneManagement;
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
public enum AvailableScenes {
|
|
|
|
MainMenu,
|
2024-01-12 11:36:49 +01:00
|
|
|
CompositionMenu,
|
|
|
|
QuizzMode,
|
2023-11-02 12:25:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public class ChangeScene : MonoBehaviour
|
|
|
|
{
|
|
|
|
|
|
|
|
public Button button;
|
|
|
|
public AvailableScenes sceneToChange = AvailableScenes.MainMenu;
|
|
|
|
readonly Dictionary<AvailableScenes, String> _scenesNames = new Dictionary<AvailableScenes, String>()
|
|
|
|
{
|
|
|
|
{ AvailableScenes.MainMenu, "MainMenu" },
|
2024-01-12 11:50:10 +01:00
|
|
|
{ AvailableScenes.CompositionMenu, "CompositionMode" },
|
2024-01-12 11:36:49 +01:00
|
|
|
{ AvailableScenes.QuizzMode, "QuizzMode" },
|
2023-11-02 12:25:50 +01:00
|
|
|
};
|
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
if (button != null)
|
|
|
|
{
|
|
|
|
button.onClick.AddListener(this.OnClick);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnClick()
|
|
|
|
{
|
|
|
|
SceneManager.LoadScene(_scenesNames[this.sceneToChange], LoadSceneMode.Single);
|
|
|
|
}
|
|
|
|
}
|