示例#1
0
        public void LoadLevel(string levelName, Action <string> onLevelLoaded, bool isShowingLoadingScreen = false)
        {
            bool value = currentlyLoadedScenes.Any(x => x == levelName);

            if (value)
            {
                Debug.LogFormat("Current level ({0}) is already loaded into the game.", levelName);
                return;
            }

            LevelLoadingData lld = new LevelLoadingData();

            lld.ao            = SceneManager.LoadSceneAsync(levelName, LoadSceneMode.Additive);
            lld.sceneName     = levelName;
            lld.onLevelLoaded = onLevelLoaded;
            levelsLoading.Add(lld);

            if (isShowingLoadingScreen)
            {
                //ApplicationManager.Instance.ShowLoadingScreen();
            }
        }
示例#2
0
        public void LoadLevel(string LevelName, OnLevelLoaded OnLevelLoaded, bool ShowLoadingScreen = false)
        {
            bool value = currentlyLoadedScenes.Any(x => x == LevelName);

            if (value)
            {
                Debug.Log(string.Format("Current level ({0}) is already loaded into the game.", LevelName));
                return;
            }


            LevelLoadingData lld = new LevelLoadingData();

            lld.AO             = SceneManager.LoadSceneAsync(LevelName, LoadSceneMode.Additive);
            lld.SceneName      = LevelName;
            lld.onLevelLoaded += OnLevelLoaded;
            levelsLoading.Add(lld);

            if (ShowLoadingScreen)
            {
                ApplicationManager.Instance.ShowLoadingScreen();
            }
        }
        public IEnumerator LoadLevel(string levelName, Action <string> onLevelLoaded, bool isShowingLoadingScreen = false)
        {
            bool value = currentlyLoadedScenes.Any(x => x == levelName);

            if (value)
            {
                Debug.LogFormat("Current level ({0}) is already loaded into the game.", levelName);
                yield break;
            }

            LevelLoadingData lld = new LevelLoadingData();

            lld.ao = SceneManager.LoadSceneAsync(levelName, LoadSceneMode.Additive);
            while (!lld.ao.isDone)
            {
                yield return(null);
            }
            lld.sceneName     = levelName;
            lld.onLevelLoaded = onLevelLoaded;
            levelsLoading.Add(lld);

            if (levelName == "Level")
            {
                Debug.Log("emit EnteredGame");
                GameObject CodeNetworking = GameObject.FindGameObjectWithTag("CodeNetworking");
                CodeNetworking.GetComponent <NetworkClient>().EnteredGame();
                //GameObject camera = GameObject.FindGameObjectWithTag("UnderCam");
                //camera.GetComponent<CameraManager>().setUnderCamera();
            }

            if (isShowingLoadingScreen)
            {
                //Turn on your loading screen here
                //ApplicationManager.Instance.ShowLoadingScreen();
            }
        }