ReisenTasker/Assets/Scripts/LevelSwitcher.cs
2026-09-03 08:59:35 -07:00

47 lines
908 B
C#

using UnityEngine;
using UnityEngine.SceneManagement;
public class LevelSwitcher : MonoBehaviour
{
#region Statication
public static LevelSwitcher instance;
private void Awake()
{
if (instance != null && instance != this)
{
Destroy(gameObject);
return;
}
DontDestroyOnLoad(this);
instance = this;
}
#endregion
[SerializeField] private int mapSceneIndex;
[SerializeField] private int microGameSceneIndex;
public void LoadMap(Map requestedMap, int exitIndex)
{
SceneManager.LoadScene(mapSceneIndex);
Map newMap = Instantiate(requestedMap);
newMap.Load();
//load player and set to exit position
}
public void SwitchMenu(int sceneIndex)
{
SceneManager.LoadScene(sceneIndex);
}
public void LoadMicroGame(MicroGameHandler gameToLoad)
{
SceneManager.LoadScene(microGameSceneIndex);
Instantiate(gameToLoad);
//instantiate the handler
//go from there
}
}