This commit is contained in:
Gerard Gascón 2025-04-24 17:29:51 +02:00
commit 3b4c6e0ec6
506 changed files with 434142 additions and 0 deletions

View file

@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class LevelLoader : MonoBehaviour{
Animator anim;
[SerializeField, Range(0f, 3f)] float fadeDuration = 1f;
public static LevelLoader instance;
void Awake(){
instance = this;
anim = GetComponent<Animator>();
}
public void LoadScene(int scene){
StartCoroutine(LoadLevel(scene));
}
IEnumerator LoadLevel(int scene){
anim.SetTrigger("Fade");
yield return new WaitForSecondsRealtime(fadeDuration);
SceneManager.LoadSceneAsync(scene);
Time.timeScale = 1;
}
}