private IEnumerator BeginChange(string sceneName, string fileName, Scene oldScene) { GameManager.CurrentScene = null; AsyncOperation unloadoperation = SceneManager.UnloadSceneAsync(oldScene); AsyncOperation loadoperation = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive); while (!unloadoperation.isDone || !loadoperation.isDone) { Network.Process(); float progress = Mathf.Clamp01(loadoperation.progress / .9f) + Mathf.Clamp01(unloadoperation.progress / .9f); progress /= 2f; slider.value = progress; yield return(null); } GameManager.CurrentScene.LoadMap(fileName); GameManager.GameScene.MiniMapDialog.CreateMinimap(fileName); GameManager.UserGameObject.transform.position = GameManager.CurrentScene.Cells[GameManager.User.Player.CurrentLocation.x, GameManager.User.Player.CurrentLocation.y].position; slider.value = 1f; loadoperation = null; unloadoperation = null; Hide(); Network.Enqueue(new C.MapChanged { }); }
private IEnumerator BeginLoad(string sceneName, string fileName) { AsyncOperation operation = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive); while (!operation.isDone) { Network.Process(); float progress = Mathf.Clamp01(operation.progress / .9f); slider.value = progress; yield return(null); } GameManager.CurrentScene.LoadMap(fileName); GameManager.GameScene.MiniMapDialog.CreateMinimap(fileName); slider.value = operation.progress; operation = null; Hide(); Network.Enqueue(new C.MapLoaded { }); }
void Update() { Network.Process(); ProcessScene(); }