SquareDash/Assets/Scripts/LevelChanger.cs
2023-12-29 02:26:42 +01:00

31 lines
667 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class LevelChanger : MonoBehaviour
{
public Animator animator;
private int levelToLoad;
void Start()
{
if(SceneManager.GetActiveScene().buildIndex==1)
{
animator.SetBool("IsLobby", true);
}
else{
animator.SetBool("IsLobby", false);
}
}
public void FadeToLevel (int levelIndex)
{
levelToLoad = levelIndex;
animator.SetTrigger("FadeOut");
}
public void OnFadeComplete ()
{
SceneManager.LoadScene(levelToLoad);
}
}