26 lines
479 B
C#
26 lines
479 B
C#
using UnityEngine;
|
|
|
|
namespace Scampz.GameJam
|
|
{
|
|
public class LevelChanger : MonoBehaviour
|
|
{
|
|
public Animator animator;
|
|
public int sceneIndex = 0;
|
|
|
|
public static LevelChanger Singleton { get; private set; }
|
|
|
|
public void OnTriggerEnter(Collider collider)
|
|
{
|
|
animator.SetTrigger("FadeOut");
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
if (Singleton is not null && Singleton != this)
|
|
Destroy(this);
|
|
else
|
|
Singleton = this;
|
|
}
|
|
}
|
|
}
|