Files
RoomAwareVR/Assets/_Scripts/Utility/Not in use/GameStarter.cs
T
2025-10-02 00:07:11 +02:00

52 lines
1.2 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
// Ehemaliges Skript für die Start-Szene. Nicht mehr in Verwendung
public class GameStarter : MonoBehaviour
{
[SerializeField] int startScene = 1;
private int currentscene;
private int nextscene;
private void OnEnable()
{
StopRecordingTrigger.OnRecordStop += HandleRecordStop;
}
private void OnDisable()
{
StopRecordingTrigger.OnRecordStop -= HandleRecordStop;
}
private void Awake()
{
DontDestroyOnLoad(this);
currentscene = startScene;
}
// Update is called once per frame
void Update()
{
if (OVRInput.GetDown(OVRInput.Button.SecondaryIndexTrigger))
{
if (SceneManager.GetActiveScene() != SceneManager.GetSceneByBuildIndex(startScene)) return;
nextscene = currentscene + 1;
currentscene = nextscene;
StartGameByLoadingScene(nextscene);
}
}
void StartGameByLoadingScene(int sceneIndex)
{
SceneManager.LoadScene(sceneIndex);
}
private void HandleRecordStop()
{
StartGameByLoadingScene(startScene);
}
}