Esempio n. 1
0
        protected void DoVerifyEnter()
        {
            var scene_names_to_load = FirstScenesEntryLoad
                                      .Concat(SecondScenesEntryLoad)
                                      .ToArray();
            var inner_exceptions = new List <Exception>();

            foreach (var scene_name in scene_names_to_load)
            {
                Debug.Log("Verifying " + scene_name);
                // Verify that the scenes to be loaded are valid before enqueing the loader coroutine
                if (!Application.CanStreamedLevelBeLoaded(scene_name))
                {
                    throw new ArgumentException("Scene cannot not be loaded: \"" + scene_name + "\"");
                }
                // Verify that none of the scenes to be loaded are already loaded
                // This limitation is caused by SceneManager.SetActiveScene being really BAD
                var scene = SceneManager.GetSceneByName(scene_name);
                if (scene.isLoaded)
                {
                    inner_exceptions.Add(new RedundantSceneException(
                                             "Scene cannot be loaded more than once: \"" + scene_name + "\"", scene_name));
                }
            }
            if (inner_exceptions.Any())
            {
                throw new AggregateException("Could not verify enter", inner_exceptions.ToArray());
            }
        }
Esempio n. 2
0
        protected void DoEnter(ControlledStateManager manager, bool skip_if_already_loaded)
        {
            var scene_names_to_load = FirstScenesEntryLoad
                                      .Concat(SecondScenesEntryLoad)
                                      .ToArray();

            //manager.EnqueueDeferredCoroutine(OnStateEnterCoroutine(scene_names_to_load).GetEnumerator());
            manager.EnqueueCoroutine(OnStateEnterCoroutine(scene_names_to_load, skip_if_already_loaded).GetEnumerator());
        }