Esempio n. 1
0
 void OnSceneLoadCompleted(AsyncOperation op)
 {
     UIManager.instance.toggleHUD(LoadHUD);
     UIManager.instance.toggleHUDStateLock(LockHUD);
     startupEvents?.Invoke();
     OnSceneLoad?.Invoke();
 }
Esempio n. 2
0
        public static void SceneLoad()
        {
            Scene scene = SceneManager.GetActiveScene();

            //DebugManager.LogToFile("[OnSceneLoad] " + scene.name + " has loaded");
            OnSceneLoad?.Invoke(scene);
        }
Esempio n. 3
0
    // 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;
    }
Esempio n. 4
0
 public void Load()
 {
     OnSceneLoad?.Invoke(this);
     _Objects.ForEach(
         s =>
     {
         s.Draw();
     });
 }
Esempio n. 5
0
            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));
            }
Esempio n. 6
0
        IEnumerator LoadLevel(string level)
        {
            yield return(SceneManager.LoadSceneAsync(level, LoadSceneMode.Single));

            if (onSceneLoad != null)
            {
                onSceneLoad();
                onSceneLoad = null;
            }
        }
Esempio n. 7
0
        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);
                });
            });
        }
Esempio n. 8
0
    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();
        }
    }
Esempio n. 9
0
        /// <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);
            }
        }
Esempio n. 10
0
    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;
            }
        }
    }
Esempio n. 12
0
    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);
        }
    }
Esempio n. 13
0
        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();
 }
Esempio n. 15
0
 // Called Second
 void OnSceneLoaded(Scene scene, LoadSceneMode mode)
 {
     Debug.Log($"OnSceneLoaded called: {scene}");
     OnSceneLoad?.Invoke(scene);
 }
Esempio n. 16
0
 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));
 }
Esempio n. 17
0
 public static void LoadPreparedScene(SceneAsync scene)
 {
     OnSceneLoad?.Invoke(scene.name);
     scene.ao.allowSceneActivation = true;
 }
Esempio n. 18
0
 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;
 }
Esempio n. 19
0
 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));
 }
Esempio n. 20
0
 private static void Studio_ImportScene_Prefix(string _path)
 {
     Core.DebugLog($"Studio_ImportScene_Prefix");
     OnSceneLoad?.Invoke(null, new SceneLoadEventArgs(_path, SceneLoadMode.Import, SceneLoadState.Pre));
 }
Esempio n. 21
0
 public void LoadGameLevel(OnSceneLoad callback)
 {
     onSceneLoad = callback;
     StartCoroutine(LoadLevel("scene1"));
 }
Esempio n. 22
0
 public static void LoadScene(string sceneName)
 {
     OnSceneLoad?.Invoke(sceneName);
     SceneManager.LoadScene(sceneName);
 }
Esempio n. 23
0
 private static void Studio_SaveScene_Prefix()
 {
     Core.DebugLog($"Studio_SaveScene_Prefix");
     OnSceneLoad?.Invoke(null, new SceneLoadEventArgs(null, SceneLoadMode.Save, SceneLoadState.Pre));
 }