Ejemplo 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);
        }
    }
 void Start()
 {
     CameraFade.FadeFrom(1, FadeDuration);
 }