IEnumerator SwitchSceneSequence(string sceneName, int sceneEntranceIndex, SceneSwitchTrigger exit)
    {
        GameObject player    = RpgPlayer.instance.gameObject;
        Vector3    spawnArea = exit.spawnArea.position;

        Debug.Log("trying to load at this entrance" + sceneEntranceIndex);
        spawnLocation = sceneEntranceIndex;

        player.GetComponent <CharacterMovement>().externalMoveCharacter(spawnArea, Vector3.zero, 1.5f, 5.0f);
        yield return(TransitionManager.instance.screenFader.FadeOut());

        SceneManager.LoadScene(sceneName);

        yield return(null);
    }
    IEnumerator SpawnPlayerAtEntrance()
    {
        CameraMan.instance.CameraBounds   = FindObjectOfType <ReisenSceneManager>().CameraBounds;
        CameraMan.instance.smoothMovement = false;

        GameObject player = RpgPlayer.instance.gameObject;

        SceneSwitchTrigger entrance = FindObjectOfType <ReisenSceneManager>().sceneEntrances[spawnLocation];

        entrance.triggerActive = false;
        Vector3 spawnPosition    = entrance.spawnArea.position;
        Vector3 spawnDestination = entrance.spawnFinalPosition.position;

        player.transform.position = spawnPosition;

        yield return(player.GetComponent <CharacterMovement>().moveCharacter(spawnDestination, spawnPosition - spawnDestination, 3.5f, 5.0f));

        CameraMan.instance.smoothMovement = true;
        entrance.triggerActive            = true;
    }
 public void SceneExit(string targetSceneName, int sceneEntranceIndex, SceneSwitchTrigger exit)
 {
     StartCoroutine(SwitchSceneSequence(targetSceneName, sceneEntranceIndex, exit));
 }