31 lines
667 B
C#
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);
|
|
}
|
|
}
|