public static void GoToLevel(string sceneAlias, Vector2?playerPosition = null) { if (changingScene) { return; } changingScene = true; MHSFader.FadeOut(0.75f, () => { if (playerPosition != null) { Player.preloadPosition = playerPosition; } MHSFader.instance.preventAutomaticFadeIn = true; MHS.LoadScene(sceneAlias); }); }
void Start() { player = Global.GetPlayer().gameObject; // If intro sequence is false if (!Global.gameData.forestIntroSequence) { MHSFader.instance.preventAutomaticFadeIn = true; player.GetComponent <Player>().playerGraphic.SetActive(false); player.GetComponent <PlayerMovement>().movementMode = PlayerMovement.MovementModes.None; CineTarget.instance.cineMode = CineTarget.CineModes.Position; targetStartMarker = CineTarget.instance.transform.position; ProCamera2D.Instance.CenterOnTargets(); MHSFader.FadeOut(0); MHS.WaitRun(3, () => { MHSFader.FadeIn(3); Vector2 targetEndMarker = new Vector2(0, 3); MHS.WaitRun(4, () => { MHSTools.MoveEntitySmooth(CineTarget.instance.transform, new Vector2(0, 4), 6, () => { MHS.WaitRun(2, () => { MessageBoxController.BuildMessages( "Huh, I don't remember sleeping here..." ).Next(() => { player.GetComponent <PlayerMovement>().movementMode = PlayerMovement.MovementModes.NoPlayerInteraction; player.GetComponent <Player>().playerGraphic.SetActive(true); player.transform.position = new Vector2(0, 6.5f); MHS.RunUntil(() => player.GetComponent <Prime31.CharacterController2D>().isGrounded, null, () => { GameObject.Instantiate(smokeBurstUp, player.transform.position + new Vector3(0, -0.4f), Quaternion.identity); AudioManager.instance.PlaySFX("Thump"); player.GetComponent <Player>().playerGraphic.GetComponent <Animator>().SetTrigger("FallFlat"); ProCamera2D.Instance.GetComponent <ProCamera2DShake>().Shake(1f, new Vector2(5f, 5f), 10, 0.1f, -1, new Vector3(5, 5, 10), 0.5f, false); MHS.WaitRun(2, () => { MessageBoxController.BuildMessages( "... OUCH" ).Next(() => { MHS.WaitRun(0.5f, () => { AudioManager.instance.PlayMusic(Global.instance.defaultMusic); MessageBoxController.BuildMessages( new MessageBoxParams { Text = "I better take a look around..." } ).Next(() => { player.GetComponent <Player>().playerGraphic.GetComponent <Animator>().SetTrigger("StandUpDizzy"); MHS.WaitRun(4f, () => { player.GetComponent <PlayerMovement>().movementMode = PlayerMovement.MovementModes.Normal; CineTarget.instance.cineMode = CineTarget.CineModes.Target; CineTarget.instance.target = player.transform; // Save Global.gameData.forestIntroSequence = true; Global.Save(); }); }); }); }); }); }); }); }); }); }); }); } // If intro sequence is true else { } }