init
This commit is contained in:
commit
3b4c6e0ec6
506 changed files with 434142 additions and 0 deletions
28
Assets/Scripts/Menu/LevelLoader.cs
Normal file
28
Assets/Scripts/Menu/LevelLoader.cs
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue