1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| public class SceneManager : ManagerBase<SceneManager> { public List<string> sceneList = new List<string>(); public int CurrentIndex=0; private System.Action<float> currentAction; private AsyncOperation operation; public void LoadScene(string sceneName,System.Action<float> action){ currentAction = action; if(sceneList.Contains(sceneName)){ CurrentIndex = sceneList.IndexOf(sceneName); operation = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(sceneName,UnityEngine.SceneManagement.LoadSceneMode.Single); } } void Update(){ if(operation !=null){ currentAction(opration.prograss); if(operation.prograss>1){ opreation = null; } } } }
|