Ejemplo n.º 1
0
        public static void UnLoaded(LOD lod)
        {
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                GameObject.DestroyImmediate(lod.Handle.Result);
            }
            else
            {
                GameObject.Destroy(lod.Handle.Result);
            }
#else
            GameObject.Destroy(lod.Handle.Result);
#endif

            AssetLoadManager.Instance.UnloadAsset(lod.Handle);
            lod.Handle       = null;
            lod.CurrentState = State.UnLoaded;
        }
Ejemplo n.º 2
0
        //正常模式只有显示和隐藏
        public static void SetState(bool active, LOD lod, LODGroup lodGroup, float distance, CameraType type)
        {
            switch (lod.CurrentState)
            {
            case State.None:
            case State.UnLoaded:
                if (active == true)
                {
                    LoadAsset(lod, lodGroup, distance, type);
                }

                break;

            case State.Loading:
                if (active == false)
                {
                    UnLoaded(lod);
                }

                break;

            case State.Loaded:
                if (active == false)
                {
                    UnLoaded(lod);
                }
                else if (lod.LastState == State.Loading)
                {
                    return;
                }

                break;
            }

            lod.LastState = lod.CurrentState;
        }