Ejemplo n.º 1
0
    IEnumerator _LoadMainScene(Slider loadingScreenLoadingBar, string sceneName)
    {
        AsyncOperation loading = SceneManager.LoadSceneAsync(sceneName);

        Debug.Log("loadi ng started !");

        while (!loading.isDone)
        {
            yield return(null);

            loadingScreenLoadingBar.value = Mathf.Clamp01(loading.progress / 0.9f);
        }
        Debug.Log("loading END !");

        if (sceneName == mainSceneName)
        {
            zd.Init();
            pm.GetCollectibles();


            if (isHost)
            {
                Launch();
            }
            else
            {
                ClientScene.Ready(clientConnection);
                ClientScene.AddPlayer(0);
            }
        }
        //else if (sceneName == mainMenuSceneName)
        //DO THING
    }