Beispiel #1
0
        /// <summary>
        /// Unpauses the game immediately if it was paused.
        /// </summary>
        private static void ImmediateUnpauseIfPaused()
        {
            if (UIManager.instance != null)
            {
                if (UIManager.instance.uiState.Equals(UIState.PAUSED))
                {
                    var gm = global::GameManager.instance;

                    ReflectionHelper.GetField <global::GameManager, GameCameras>(gm, "gameCams").ResumeCameraShake();
                    gm.inputHandler.PreventPause();
                    gm.actorSnapshotUnpaused.TransitionTo(0f);
                    gm.isPaused = false;
                    gm.ui.AudioGoToGameplay(0.2f);
                    gm.ui.SetState(UIState.PLAYING);
                    gm.SetState(GameState.PLAYING);
                    if (HeroController.instance != null)
                    {
                        HeroController.instance.UnPause();
                    }

                    MenuButtonList.ClearAllLastSelected();
                    gm.inputHandler.AllowPause();
                }
            }
        }
        public static void ChangeToScene(string sceneName, string gateName, float delay = 0f)
        {
            UIManager.instance.UIClosePauseMenu();
            Time.timeScale = 1f;
            GameManager.instance.FadeSceneIn();
            GameManager.instance.isPaused = false;
            GameCameras.instance.ResumeCameraShake();
            if (HeroController.instance != null)
            {
                HeroController.instance.UnPause();
            }
            MenuButtonList.ClearAllLastSelected();
            TimeController.GenericTimeScale = 1f;
            GameManager.instance.actorSnapshotUnpaused.TransitionTo(0f);
            GameManager.instance.ui.AudioGoToGameplay(.2f);
            if (HeroController.instance != null)
            {
                HeroController.instance.UnPause();
            }
            MenuButtonList.ClearAllLastSelected();
            PlayerData.instance.atBench = false; // kill bench storage

            SceneLoad load = ReflectionHelper.GetAttr <GameManager, SceneLoad>(GameManager.instance, "sceneLoad");

            if (load != null)
            {
                load.Finish += () =>
                {
                    LoadScene(sceneName, gateName, delay);
                };
            }
            else
            {
                LoadScene(sceneName, gateName, delay);
            }
        }