void OnSceneLoadCompleted(AsyncOperation op) { UIManager.instance.toggleHUD(LoadHUD); UIManager.instance.toggleHUDStateLock(LockHUD); startupEvents?.Invoke(); OnSceneLoad?.Invoke(); }
public static void SceneLoad() { Scene scene = SceneManager.GetActiveScene(); //DebugManager.LogToFile("[OnSceneLoad] " + scene.name + " has loaded"); OnSceneLoad?.Invoke(scene); }
// For loading from pause public void LoadInGame(int slot) { // removes overlay text that shouldn't be present foreach (Tutorial canv in FindObjectsOfType <Tutorial>()) { Destroy(canv.tutorialPanel); } foreach (NPCManager npc in FindObjectsOfType <NPCManager>()) { Destroy(npc.subtitlePanel); } // // No scene reloading, just loads the data, and moves things already in the scene, then pauses time. // Nevermind, now has scene reloading // Inelegant solution, but it works SaveLoad.Load(slot); if (currentPuzzle.sceneName != currentLevel) { loadedPuzzle = false; levelToLoad = currentPuzzle.sceneName; OnSceneLoad.NewLevel(); } objectManager.allCameras.Clear(); objectManager.FindCameras(); OnSceneLoad.PuzzleLoaded(); // Forces the cameras to switch to saved indexes if (cameraIndexes.Count == 4) { objectManager.visibleCameras.Clear(); foreach (CameraSwitcher cam in camSwitch) { cam.currentIndex = cameraIndexes[Array.IndexOf(camSwitch, cam)]; cam.screenMaterial.material = screenMaterials[cam.currentIndex]; objectManager.visibleCameras.Add(objectManager.allCameras[cam.currentIndex]); } } MoveObject[] movables = FindObjectsOfType <MoveObject>(); foreach (MoveObject obj in movables) { if (obj.computer != null) { if (obj.computer.activate) { obj.transform.localPosition = obj.openPosition; } } } Time.timeScale = 0; }
public void Load() { OnSceneLoad?.Invoke(this); _Objects.ForEach( s => { s.Draw(); }); }
internal static IEnumerator Studio_ImportScene_Postfix_Coroutine(string _path, SceneLoadMode _mode) { yield return(Toolbox.WaitForEndOfFrame); yield return(Toolbox.WaitForEndOfFrame); Core.DebugLog($"Studio_ImportScene_Postfix_Coroutine [mode: {_mode}]"); OnSceneLoad?.Invoke(null, new SceneLoadEventArgs(_path, SceneLoadMode.Import, SceneLoadState.Coroutine)); }
IEnumerator LoadLevel(string level) { yield return(SceneManager.LoadSceneAsync(level, LoadSceneMode.Single)); if (onSceneLoad != null) { onSceneLoad(); onSceneLoad = null; } }
public static void LoadAndCloseScene(string sceneName, float closeTime, Action onComplete = null) { LoadSceneAsync(sceneName, LoadSceneMode.Additive, () => { OnSceneLoad.SafeInvoke(sceneName); CoroutineManager.DoAfterGivenTime(closeTime, () => { UnloadSceneAsync(sceneName, onComplete.SafeInvoke); }); }); }
private void OnTriggerEnter(Collider col) { if (col.name == "Player" && PGM.Instance.currentPuzzle.completed == true) { PGM.Instance.puzzlesCompleted += 1; PGM.Instance.exitedLevel = true; PGM.Instance.AddEvents("levelComplete"); PGM.Instance.loadedPuzzle = false; OnSceneLoad.NewLevel(); } }
/// <summary> /// Sets the currently active scene to the provided scene. /// </summary> /// <param name="scene">Scene which to set as active.</param> internal static void SetActive(Prefab scene) { activateOnLoadScene = null; if (scene != null) { activeSceneUUID = scene.UUID; activeSceneName = scene.Name; isGenericPrefab = !scene.IsScene; Internal_SetActiveScene(scene.GetCachedPtr()); OnSceneLoad?.Invoke(activeSceneUUID); } }
public static event System.Action <int> OnSceneLoad; // Gotta send an int over due to GetSceneIndex returning the old index public void LoadNextScene() { int currentSceneIndex = SceneManager.GetActiveScene().buildIndex; if (currentSceneIndex + 1 >= SceneManager.sceneCountInBuildSettings) { Debug.LogWarning("Game Scene Manager attempted to load a scene index greater than the ones avaliable. Reloading first scene..."); SceneManager.LoadScene(0); } else { currentSceneIndex++; SceneManager.LoadScene(currentSceneIndex); OnSceneLoad?.Invoke(currentSceneIndex); } }
public void UpdateScene(State state) { foreach (StateInfo sI in StateInfoList) { if (sI.State == state) { Debug.Log("Whaddup"); CurrentStateInfo = sI; loadingOperation = SceneManager.LoadSceneAsync("TestScene"); loadingOperation.completed += LoadingComplete; OnSceneLoad?.Invoke(loadingOperation); break; } } }
public void LoadPreviousScene() { int currentSceneIndex = SceneManager.GetActiveScene().buildIndex; if (currentSceneIndex - 1 < 0) { Debug.LogWarning("Game Scene Manager attempted to load a scene index greater than the ones avaliable. Reloading first scene..."); SceneManager.LoadScene(0); } else { currentSceneIndex--; SceneManager.LoadScene(currentSceneIndex); OnSceneLoad?.Invoke(currentSceneIndex); } }
public static void LoadSceneAsync(string sceneName, LoadSceneMode loadSceneMode = LoadSceneMode.Additive, Action onComplete = null) { if (LoadedScenes.Contains(sceneName)) { return; } LoadedScenes.Add(sceneName); UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(sceneName, loadSceneMode); UnityEngine.SceneManagement.SceneManager.sceneLoaded += (scene, loadMode) => { if (scene.name != sceneName) { return; } onComplete.SafeInvoke(); OnSceneLoad.SafeInvoke(sceneName); }; }
void SceneLoaded(Scene scene, LoadSceneMode loadSceneMode) { OnSceneLoad?.Invoke(); }
// Called Second void OnSceneLoaded(Scene scene, LoadSceneMode mode) { Debug.Log($"OnSceneLoaded called: {scene}"); OnSceneLoad?.Invoke(scene); }
private static void Studio_SaveScene_Postfix() { Core.DebugLog($"Studio_SaveScene_Postfix"); OnSceneLoad?.Invoke(null, new SceneLoadEventArgs(null, SceneLoadMode.Save, SceneLoadState.Post)); Instance.StartCoroutine(Studio_SaveScene_Postfix_Coroutine(null, SceneLoadMode.Save)); }
public static void LoadPreparedScene(SceneAsync scene) { OnSceneLoad?.Invoke(scene.name); scene.ao.allowSceneActivation = true; }
private static IEnumerator Studio_LoadSceneCoroutine_Postfix_Coroutine(string _path) { Core.DebugLog($"Studio_LoadSceneCoroutine_Postfix_Coroutine"); OnSceneLoad?.Invoke(null, new SceneLoadEventArgs(_path, SceneLoadMode.Load, SceneLoadState.Post)); yield break; }
private static void Studio_ImportScene_Postfix(string _path) { Core.DebugLog($"Studio_ImportScene_Postfix"); OnSceneLoad?.Invoke(null, new SceneLoadEventArgs(_path, SceneLoadMode.Import, SceneLoadState.Post)); Instance.StartCoroutine(Studio_ImportScene_Postfix_Coroutine(_path, SceneLoadMode.Import)); }
private static void Studio_ImportScene_Prefix(string _path) { Core.DebugLog($"Studio_ImportScene_Prefix"); OnSceneLoad?.Invoke(null, new SceneLoadEventArgs(_path, SceneLoadMode.Import, SceneLoadState.Pre)); }
public void LoadGameLevel(OnSceneLoad callback) { onSceneLoad = callback; StartCoroutine(LoadLevel("scene1")); }
public static void LoadScene(string sceneName) { OnSceneLoad?.Invoke(sceneName); SceneManager.LoadScene(sceneName); }
private static void Studio_SaveScene_Prefix() { Core.DebugLog($"Studio_SaveScene_Prefix"); OnSceneLoad?.Invoke(null, new SceneLoadEventArgs(null, SceneLoadMode.Save, SceneLoadState.Pre)); }