Beispiel #1
0
    // Načte scénu s generátorem mapy (scéna s postavou je načtena) a odnačte scénu s výběrem úrovní
    IEnumerator LoadMazeAsync(string locationSceneName, MazeSettingsSO mazeSettings)
    {
        _loading = true;
        _loadingScreen.ShowLoadingScreen();
        Player.SetActive(false);
        CurrentHubManager  = null;
        CurrentMazeManager = null;
        AsyncOperation locationSceneLoadingTask = SceneManager.LoadSceneAsync(locationSceneName, LoadSceneMode.Additive);

        while (!locationSceneLoadingTask.isDone)
        {
            yield return(null);
        }

        SceneManager.SetActiveScene(SceneManager.GetSceneByName(locationSceneName));

        while (CurrentMazeManager == null)
        {
            yield return(null);
        }

        string message = CurrentMazeManager.CreateMaze(mazeSettings);

        QuestUI.QueueMessage(message);

        CurrentHubManager = null;
        UnloadScene(HUB_SCENE_NAME);

        Player.SetActive(true);
        _loading = false;
        _loadingScreen.HideLoadingScreen();
    }