initial commit

This commit is contained in:
2026-10-12 21:28:47 +01:00
commit 6dd11d33ae
11551 changed files with 2353518 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
using UnityEngine;
using UnityEngine.SceneManagement;
public class LevelExit : MonoBehaviour
{
[SerializeField] private string nextSceneName = "Level 2";
[SerializeField] private bool loadNextBuildIndex = false;
private bool isTransitioning = false;
private void OnTriggerEnter(Collider other)
{
if (isTransitioning) return;
if (other.CompareTag("Player"))
{
isTransitioning = true;
if (loadNextBuildIndex)
{
int nextIndex = SceneManager.GetActiveScene().buildIndex + 1;
if (nextIndex < SceneManager.sceneCountInBuildSettings)
{
SceneManager.LoadScene(nextIndex);
}
else
{
Debug.Log("No more scenes in build settings. Reloading current scene.");
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
}
else if (!string.IsNullOrEmpty(nextSceneName))
{
SceneManager.LoadScene(nextSceneName);
}
}
}
}