40 lines
976 B
C#
40 lines
976 B
C#
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.SceneManagement;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public enum AvailableScenes {
|
||
|
MainMenu,
|
||
|
CompoMenu,
|
||
|
PreviewMenu,
|
||
|
Fusion,
|
||
|
}
|
||
|
|
||
|
public class ChangeScene : MonoBehaviour
|
||
|
{
|
||
|
|
||
|
public Button button;
|
||
|
public AvailableScenes sceneToChange = AvailableScenes.MainMenu;
|
||
|
readonly Dictionary<AvailableScenes, String> _scenesNames = new Dictionary<AvailableScenes, String>()
|
||
|
{
|
||
|
{ AvailableScenes.MainMenu, "MainMenu" },
|
||
|
{ AvailableScenes.CompoMenu, "CompositionMenu" },
|
||
|
{ AvailableScenes.Fusion, "Fusion" },
|
||
|
};
|
||
|
// 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);
|
||
|
}
|
||
|
}
|