init
This commit is contained in:
commit
341a877b4a
2338 changed files with 1346408 additions and 0 deletions
43
Assets/Scripts/Tools/SceneManager/SceneLoader.cs
Normal file
43
Assets/Scripts/Tools/SceneManager/SceneLoader.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class SceneLoader : MonoBehaviour{
|
||||
|
||||
Animator anim;
|
||||
[SerializeField, Range(0f, 3f)] float fadeDuration = 1f;
|
||||
|
||||
public static SceneLoader instance;
|
||||
|
||||
void Awake(){
|
||||
instance = this;
|
||||
anim = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
/// <summary> Loads the scene. </summary>
|
||||
public void LoadScene(int scene){
|
||||
StartCoroutine(LoadLevel(scene));
|
||||
}
|
||||
|
||||
IEnumerator LoadLevel(int scene){
|
||||
if(anim != null)
|
||||
anim.SetTrigger("Fade");
|
||||
yield return new WaitForSecondsRealtime(fadeDuration);
|
||||
Loader.Load(scene);
|
||||
}
|
||||
|
||||
/// <summary> Loads the scene with a certain delay. </summary>
|
||||
public void LoadScene(int scene, float delay){
|
||||
StartCoroutine(LoadLevel(scene, delay));
|
||||
}
|
||||
|
||||
IEnumerator LoadLevel(int scene, float delay){
|
||||
yield return new WaitForSecondsRealtime(delay);
|
||||
if (anim != null)
|
||||
anim.SetTrigger("Fade");
|
||||
yield return new WaitForSecondsRealtime(fadeDuration);
|
||||
//SceneManager.LoadSceneAsync(scene);
|
||||
Loader.Load(scene);
|
||||
}
|
||||
}
|
11
Assets/Scripts/Tools/SceneManager/SceneLoader.cs.meta
Normal file
11
Assets/Scripts/Tools/SceneManager/SceneLoader.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ede2123fe3b94fd4f812e1d322f2b7f7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue