Exemplo n.º 1
0
    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);
        }
    }
Exemplo n.º 2
0
 private void LoadScene(int buildIndex)
 {
     _sceneLoadPending = true;
     CameraFade.FadeTo(1, 0.5f, () => SceneManager.LoadScene(buildIndex), false);
 }