private void LoadFromTransition() { GlobalController.UnFadeToBlack(); FadeAudio(1); if (!GlobalController.GetSaveContainer().RuntimeLoadedOnce()) { return; } if (transition.subway) { SubwayManager.ArriveWithPlayer(); } else if (transition.beacon != null) { GlobalController.MovePlayerToBeacon(transition.beacon); } else { GlobalController.MovePlayerTo(transition.position); } }
void OnSceneLoaded(Scene scene, LoadSceneMode mode) { // reset everything and then re-enable according to scene data PlayerController pc = GlobalController.pc; pc.StopForcedWalking(); pc.inCutscene = false; GlobalController.UnFadeToBlack(); GlobalController.playerFollower.EnableFollowing(); GlobalController.playerFollower.FollowPlayer(); GlobalController.playerFollower.EnableSmoothing(); GlobalController.pauseEnabled = true; pc.UnLockInSpace(); // if the PC wasn't dashing or in supercruise if (!frozePlayerBeforeTransition) { pc.SetInvincible(false); pc.UnFreeze(); //and reset to wait for the next transition frozePlayerBeforeTransition = false; } pc.Show(); pc.EnableShooting(); GlobalController.ShowUI(); if (currentBeacon != Beacon.None) { GlobalController.MovePlayerToBeacon(currentBeacon); GlobalController.playerFollower.SnapToPlayer(); GlobalController.playerFollower.EnableFollowing(); GlobalController.playerFollower.FollowPlayer(); currentBeacon = Beacon.None; } else if (SubwayManager.playerOnSubway) { SubwayManager.ArriveWithPlayer(); } else if (toPosition) { GlobalController.MovePlayerTo(position); toPosition = false; GlobalController.playerFollower.SnapToPlayer(); GlobalController.playerFollower.EnableFollowing(); GlobalController.playerFollower.FollowPlayer(); } SceneData sd; if (GameObject.Find("SceneData") != null) { sd = GameObject.Find("SceneData").GetComponent <SceneData>(); if (sd.loadOtherSceneAtStart) { LoadScene(sd.otherSceneName, Beacon.None, fade: false); return; } GlobalController.ShowTitleText(sd.title, sd.subTitle); if (sd.hideUI) { GlobalController.HideUI(); } else { GlobalController.ShowUI(); } if (sd.lockPlayer) { pc.LockInSpace(); pc.SetInvincible(true); pc.Freeze(); pc.DisableShooting(); } else if (sd.unlockPlayer) { pc.UnLockInSpace(); pc.SetInvincible(false); pc.UnFreeze(); pc.EnableShooting(); } if (sd.hidePlayer) { pc.Hide(); } if (sd.forceFaceRight && !pc.facingRight) { pc.Flip(); } GlobalController.pauseEnabled = sd.enablePausing; } PlayerTriggeredObject triggered = GlobalController.pc.CheckInsideTrigger(); if (triggered != null) { triggered.OnPlayerEnter(); } }
void OnSceneLoaded(Scene scene, LoadSceneMode mode) { // reset everything and then re-enable according to scene data sceneData = null; loadTextUI.SetActive(false); FadeAudio(1); PlayerController pc = GlobalController.pc; pc.StopForcedWalking(); pc.inCutscene = false; GlobalController.UnFadeToBlack(); GlobalController.pauseEnabled = true; pc.UnLockInSpace(); pc.Show(); pc.ExitCutscene(); pc.EnableShooting(); GlobalController.ShowUI(); if (currentBeacon != null) { GlobalController.MovePlayerToBeacon(currentBeacon); currentBeacon = null; } else if (SubwayManager.playerOnSubway) { SubwayManager.ArriveWithPlayer(); } else if (toPosition) { GlobalController.MovePlayerTo(position, fade: true); toPosition = false; } SceneData sd; if (GameObject.Find("SceneData") != null) { sd = GameObject.Find("SceneData").GetComponent <SceneData>(); sceneData = sd; if (sd.loadOtherSceneAtStart) { LoadScene(sd.otherSceneName, null, fade: false); return; } GlobalController.ShowTitleText(sd.title, sd.subTitle); if (sd.hideUI) { GlobalController.HideUI(); } else { GlobalController.ShowUI(); } if (sd.lockPlayer) { pc.EnterCutscene(); } else if (sd.unlockPlayer) { pc.ExitCutscene(); } if (sd.hidePlayer) { pc.Hide(); pc.EnterCutscene(); } if (sd.forceFaceRight && !pc.facingRight) { pc.Flip(); } GlobalController.pauseEnabled = sd.enablePausing; } PlayerTriggeredObject triggered = GlobalController.pc.CheckInsideTrigger(); if (triggered != null) { triggered.OnPlayerEnter(); } }