Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        _followPlayer = FindObjectOfType <FollowPlayer>();

        if (PlayerPrefs.GetString("CurrentLevel") == SceneManager.GetActiveScene().name)
        {
            defaultCheckpoint = GameObject.Find(PlayerPrefs.GetString("CurrentCheckpoint"));
        }
        else
        {
            PlayerPrefs.DeleteKey("CurrentLevel");
            PlayerPrefs.DeleteKey("CurrentCheckpoint");
            PlayerPrefs.Save();
        }
        SetNewCheckpoint(defaultCheckpoint);
        transform.position = defaultCheckpoint.transform.position + new Vector3(0.5f, 0f, 0f);
        _followPlayer.ResetCamera();
    }