Exemple #1
0
    /// <summary>
    /// Respawns the player at there last checkpoint
    /// </summary>
    public void Respawn()
    {
        var load = SaveGame.LoadGame();

        if (load != null)
        {
            GameObject           obj   = Instantiate(transitionMakerObject, Vector3.zero, Quaternion.identity);
            SceneTransitionMaker maker = obj.GetComponent <SceneTransitionMaker>();
            maker.DoTransitionMovePlayer(load);
        }
        else
        {
            Debug.LogWarning("No Save file to respawn to.");
        }
    }
Exemple #2
0
    /// <summary>
    /// Goes to a scene and then places the player in the intended place
    /// </summary>
    /// <param name="targetPos"></param>
    /// <param name="sceneName"></param>
    public void GoToScene(Vector2 targetPos, string sceneName)
    {
        var load = SaveGame.LoadGame();

        if (load != null)
        {
            GameObject           obj   = Instantiate(transitionMakerObject, Vector3.zero, Quaternion.identity);
            SceneTransitionMaker maker = obj.GetComponent <SceneTransitionMaker>();

            if (maker == null)
            {
                return;
            }
            maker.DoTransitionMovePlayer(load, sceneName, targetPos);
        }
        else
        {
            Debug.LogWarning("No Save file to respawn to.");
        }
    }