コード例 #1
0
        private void DoSceneLoad()
        {
            _loadingProgess = 0;
#if DEBUG
            Debug.Log("******************************** Do Scene Load " + sceneToLoad + " ***********************************");
            Debug.Display("Loading", sceneToLoad);
#endif

            if (!isLoadingAdditive && !String.IsNullOrEmpty(loadedLevelName))
            {
                CleanUp();
                assetHelper.Unload(loadedLevelName);
                Physics.Reset();
            }

            loadingScene = true;
            isLoadingAssetBeforeSceneInitialize = true;
            loadIsComplete = false;

            if (!isLoadingAdditive)
            {
                loadedLevelName = sceneToLoad;
            }
            scene        = assetHelper.Load <Scene>("Scenes/" + sceneToLoad);
            loadingScene = false;
            if (scene != null)
            {
                System.Diagnostics.Debug.Assert(scene.hasBeenProcessed, String.Format("The scene {0} is not being processed by the SceneProcessor. Please fix this!", sceneToLoad));
                typeCaps.Add(scene.typeCaps);

                if (scene.lightmapSettings != null)
                {
                    LightmapSettings.lightmaps     = scene.lightmapSettings.lightmapData;
                    LightmapSettings.lightmapsMode = scene.lightmapSettings.lightmapMode;
                }
                else
                {
                    LightmapSettings.lightmaps = null;
                }
            }
            else
            {
                LightmapSettings.lightmaps = null;
            }
            sceneToLoad = "";
            totalNumberOfAssetsToLoad = sceneAssets.Count;
            numberOfAssetsLoaded      = 0;

            if (scene == null)
            {
                Debug.Log("Scene is NULL. Completing load!");
                SceneLoadComplete();
            }
        }
コード例 #2
0
ファイル: AudioClip.cs プロジェクト: mikecrews/FFWD
 protected override void DoLoadAsset(AssetHelper assetHelper)
 {
     if (sound == null)
     {
         sound = assetHelper.Load <SoundEffect>(clip);
         name  = clip;
         if (sound != null)
         {
             Instance = sound.CreateInstance();
         }
     }
 }
コード例 #3
0
ファイル: LayerMask.cs プロジェクト: mikecrews/FFWD
 internal static void LoadLayerNames(AssetHelper helper)
 {
     if (layerNames == null)
     {
         helper.AddStaticAsset("LayerNames");
         layerNames = new List <string>();
         string[] names = helper.Load <String[]>("LayerNames");
         if (names != null)
         {
             layerNames.AddRange(names);
         }
     }
 }
コード例 #4
0
ファイル: Material.cs プロジェクト: mikecrews/FFWD
 internal static void LoadRenderIndices(AssetHelper helper)
 {
     textureRenderIndexes.Clear();
     helper.AddStaticAsset("TextureRenderIndexes");
     string[] names = helper.Load <String[]>("TextureRenderIndexes");
     if (names != null)
     {
         for (int i = 0; i < names.Length; i++)
         {
             textureRenderIndexes.Add(names[i], i);
         }
     }
 }
コード例 #5
0
        public static UnityObject Load(string name)
        {
            // NOTE: If refactoring this please be careful with the loadingScene flag!
            Application.loadingScene = true;
            object o = AssetHelper.Load <object>("Resources", Path.Combine("Resources", name));

            if (o is Scene)
            {
                UnityObject uo = LoadScene(o as Scene);
                Application.loadingScene = false;
                return(uo);
            }
            Application.loadingScene = false;
            if (o == null)
            {
                return(null);
            }
            if (o is UnityObject)
            {
                return(o as UnityObject);
            }
            if (o is Microsoft.Xna.Framework.Graphics.Texture2D)
            {
                Texture2D Tex    = new Texture2D(o as Microsoft.Xna.Framework.Graphics.Texture2D);
                int       iIndex = name.LastIndexOf('/');
                ++iIndex;
                iIndex   = Mathf.Clamp(iIndex, 0, name.Length - 1);
                Tex.name = name.Substring(iIndex);
                return(Tex);
            }
            if (o is SoundEffect)
            {
                return(new AudioClip(o as SoundEffect));
            }
            return(null);
        }