Exemplo n.º 1
0
 protected virtual void Awake()
 {
     //Is this the first manager to be crated
     if (_instance == null)
     {
         _instance = this;
         if (Game)
         {
             Levels        = Game.Levels;
             StartingLevel = Game.StartingLevel;
         }
         foreach (LevelSceneData level in Levels)
         {
             if (level.IsAseetBundle && level.LoadAseetBundleOnStart)
             {
                 level.LoadAssestBundels();
             }
         }
     }
     else
     {
         //If not the first Destroy
         Destroy(gameObject);
     }
     SceneManager.sceneLoaded   += SceneLoaded;
     SceneManager.sceneUnloaded += SceneUnloaded;
 }
Exemplo n.º 2
0
 private void PakageUnloaded(LevelSceneData dataPackage)
 {
     if (dataPackage.IsAseetBundle && dataPackage.UnloadAseetBundleOnPakageUnload)//is a just in time unloaded bundle
     {
         dataPackage.UnloadAssestBundels();
     }
 }
        public static void LoadDataPackageInToEditor(LevelSceneData sceneData)
        {
            //Get the selected data
            if (sceneData)
            {
                int loadcount = sceneData.SceneList.Count;
                if (!String.IsNullOrEmpty(sceneData.MasterScene))
                {
                    loadcount++;
                }
                SceneSetup[] setup = new SceneSetup[loadcount];
                int          i     = 0;
                if (loadcount > sceneData.SceneList.Count)
                {
                    setup[0]          = new SceneSetup();
                    setup[0].path     = sceneData.MasterScene;
                    setup[0].isLoaded = true;
                    setup[0].isActive = true;

                    i = 1;
                }
                foreach (SceneData sdata in sceneData.SceneList)
                {
                    setup[i]          = new SceneSetup();
                    setup[i].path     = sdata.Path;
                    setup[i].isLoaded = true;
                    i++;
                }
                EditorSceneManager.RestoreSceneManagerSetup(setup);
            }
        }
        public static void LoadDataPackageInToEditor()
        {
            //Get the selected data
            ScriptableObject go   = (ScriptableObject)Selection.activeObject;
            LevelSceneData   data = (LevelSceneData)go;

            GameMasterTools.LoadDataPackageInToEditor(data);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Loads all defult scen in a level and runs the LevelScript;
        /// </summary>
        /// <param name="dataPackage"></param>
        public void LoadPackagecenes(LevelSceneData dataPackage)
        {
            //Time.timeScale = 0;
            if (LoadingOverlay)
            {
                LoadingOverlay.Show();
            }
            if (dataPackage.IsAseetBundle && !dataPackage.LoadAseetBundleOnStart)//is a just in time loaded bundle
            {
                dataPackage.LoadAssestBundels();
            }
            UnloadAllSubScenes();
            if (_loadedDatatpackage != null)
            {
                _loadedDatatpackage = null;
                PakageUnloaded(dataPackage);
            }
            _sceneLoadingCount  = 0;
            _loadedDatatpackage = dataPackage;

            if (dataPackage.MasterScene != "")
            {
                StartCoroutine(LoadAsyncScene(dataPackage.MasterScene));
                _loadingSubSceneList.Add(dataPackage.MasterScene);
                _sceneLoadingCount++;
            }
            for (int index = 0; index < dataPackage.SceneList.Count; index++)
            {
                if (dataPackage.SceneList[index].LoadOnPackageLoad)
                {
                    StartCoroutine(LoadAsyncScene(dataPackage.SceneList[index].Path));

                    _loadingSubSceneList.Add(dataPackage.SceneList[index].Path);
                    _sceneLoadingCount++;
                }
            }
        }