public static void TeleportPlayerToLastCheckpoint() { var checkpoint = Instance._lastCheckpoint; if (!checkpoint.HasValue) { SceneLoader.Instance.ReloadCurrentScene(); } else { CameraFade.FadeTo(1, 0.5f, () => { var player = Instance._player; player.transform.position = checkpoint.Value.Collider.transform.position; player.GetComponent <PlayerActor>().RestartToIinitialState(); player.UpdateDirection(Instance._directionAtCheckpoint); CameraFade.FadeFrom(1, 0.5f, null, false); }, false); } }
private void LoadScene(int buildIndex) { _sceneLoadPending = true; CameraFade.FadeTo(1, 0.5f, () => SceneManager.LoadScene(buildIndex), false); }