public void OnTransitionStart() { if (isFinished) { return; } transitionResolver.ResolveSequenceStart(); previousGame?.Scene.UnLoad(); currentSequence.TryCallTransitionEvent(); if (loadOperation != null) { return; } gameContextHandler.SetCurrentState(GameStates.Loading); loadOperation = currentGame.Scene.LoadAsync(LoadSceneMode.Additive); loadOperation.allowSceneActivation = false; }
private void OnGUI() { if (IsStarted) { return; } DrawLabel($"Difficulty : {desiredDifficulty}"); desiredDifficulty = (int)DrawSlider(desiredDifficulty, 1, 3); DrawLabel($"Bpm : {bpmTraductions[desiredBpm]}"); desiredBpm = (int)DrawSlider(desiredBpm, 1, 3); if (DrawButtons("Restart")[0]) { var microScene = SceneManager.GetSceneAt(1); if (buildIndex == -1) { buildIndex = microScene.buildIndex; } var unloadOperation = SceneManager.UnloadSceneAsync(microScene); unloadOperation.completed += op => { callbackManager.AllowCallbacks = true; SceneManager.LoadSceneAsync(buildIndex, LoadSceneMode.Additive); }; IsStarted = true; RefreshAtomValues(); gameInfoContextLinker.ResetWinIndicator(); gameContextHandler.SetCurrentState(GameStates.Loaded); } GUI.Box(new Rect(anchor.x, anchor.y, width + (margin * 2), (GUICount * lineHeight) + (margin * 2)), GUIContent.none); GUICount = 0; }