Example #1
0
        public override void OnDestroy()
        {
            _target = null;
            SharedPool <XTransformTrack> .Return(this);

            base.OnDestroy();
        }
Example #2
0
        protected void BuildMix(float start, float duration, IClip clip1, IClip clip2)
        {
            var mix = SharedPool <MixClip> .Get();

            mix.Initial(start, duration, clip1, clip2);
            AddMix(mix);
        }
Example #3
0
 public static void Clean()
 {
     sharedPool.Clear();
     goPool.Clear();
     SharedPool<Asset>.Clean();
     Resources.UnloadUnusedAssets();
 }
Example #4
0
        public static XMarker GetMarker(XTrack track, MarkData data)
        {
            XMarker marker = null;

            switch (data.type)
            {
            case MarkType.Active:
                marker = SharedPool <XActiveMark> .Get();

                break;

            case MarkType.Jump:
                marker = SharedPool <XJumpMarker> .Get();

                break;

            case MarkType.Slow:
                marker = SharedPool <XSlowMarker> .Get();

                break;
            }
            if (marker != null)
            {
                marker.Initial(track, data);
            }
            return(marker);
        }
Example #5
0
        public override IClip BuildClip(ClipData data)
        {
            var clip = SharedPool <XBoneFxClip> .Get();

            clip.data  = (BoneFxClipData)data;
            clip.track = this;
            return(clip);
        }
Example #6
0
        public override IClip BuildClip(ClipData data)
        {
            var clip = SharedPool <XPostprocessClip> .Get();

            clip.data  = (PostprocessData)data;
            clip.track = this;
            clip.OnBuild();
            return(clip);
        }
Example #7
0
        public static XTrack GetTrack(TrackData data, XSeqence tl, XTrack parent = null)
        {
            XTrack xTrack = null;

            switch (data.type)
            {
            case AssetType.Marker:
                xTrack = SharedPool <XMarkerTrack> .Get();

                break;

            case AssetType.Animation:
                xTrack = SharedPool <XAnimationTrack> .Get();

                break;

            case AssetType.BoneFx:
                xTrack = SharedPool <XBoneFxTrack> .Get();

                break;

            case AssetType.SceneFx:
                xTrack = SharedPool <XSceneFxTrack> .Get();

                break;

            case AssetType.PostProcess:
                xTrack = SharedPool <XPostprocessTrack> .Get();

                break;

            case AssetType.Transform:
                xTrack = SharedPool <XTransformTrack> .Get();

                break;

            case AssetType.LogicValue:
                xTrack = SharedPool <XLogicTrack> .Get();

                break;

            case AssetType.Group:
                xTrack = SharedPool <XGroupTrack> .Get();

                break;

            default:
                Debug.LogError("unknown track " + data.type);
                break;
            }
            if (xTrack)
            {
                xTrack.Initial(data, tl, parent);
            }
            return(xTrack);
        }
Example #8
0
        public override void OnDestroy()
        {
            if (prefabGameObject)
            {
                XResources.DestroyGameObject(path, prefabGameObject);
                particleSystems = null;
            }
            SharedPool <XSceneFxClip> .Return(this);

            base.OnDestroy();
        }
Example #9
0
        public override IClip BuildClip(ClipData data)
        {
            var clip = SharedPool <XSceneFxClip> .Get();

            clip.data  = (SceneFxClipData)data;
            clip.track = this;
            SceneFxClipData fxdata = (SceneFxClipData)data;

            clip.Load(fxdata.prefab, fxdata.pos, fxdata.rot, fxdata.scale);
            return(clip);
        }
Example #10
0
        public override void OnDestroy()
        {
            if (fx)
            {
                XResources.DestroyGameObject(path, fx);
                fx = null;
            }
            ps = null;
            SharedPool <XBoneFxClip> .Return(this);

            base.OnDestroy();
        }
Example #11
0
        public override void OnDestroy()
        {
            if (playable.IsValid())
            {
                playable.Destroy();
                if (track.mixPlayable.IsValid())
                {
                    track.mixPlayable.SetInputCount(0);
                }
            }
            XResources.DestroySharedAsset(data.anim);
            SharedPool <XAnimationClip> .Return(this);

            base.OnDestroy();
        }
Example #12
0
        public static void DestroySharedAsset(string path)
        {
            if (sharedPool.ContainsKey(path))
            {
                var asset = sharedPool[path];
                asset.refence--;
                if (asset.refence <= 0)
                {
#if !UNITY_EDITOR
                     Resources.UnloadAsset(asset.asset);
#endif
                    SharedPool<Asset>.Return(asset);
                }
            }
        }
Example #13
0
        public static T LoadSharedAsset<T>(string path) where T : Object
        {
#if UNITY_EDITOR
            if (sharedPool.ContainsKey(path))
            {
                return sharedPool[path].asset as T;
            }
            else
            {
                var asset = AssetDatabase.LoadAssetAtPath<T>(path);
                var tmp = SharedPool<Asset>.Get();
                tmp.asset = asset;
                sharedPool.Add(path, tmp);
                return asset;
            }
#else
        // assetbundle implements 
#endif
        }
Example #14
0
        public override void OnDestroy()
        {
            if (!seqence.IsHostTrack(this))
            {
                if (mixPlayable.IsValid())
                {
                    mixPlayable.Destroy();
                }
                if (playableOutput.IsOutputValid())
                {
                    XSeqence.graph.DestroyOutput(playableOutput);
                }
                mixJob.Dispose();
                SharedPool <XAnimationTrack> .Return(this);

                idx = 0;
                tmp = 0;
            }
            base.OnDestroy();
        }
Example #15
0
        public virtual void OnDestroy()
        {
            Foreach(track => track.OnDestroy(), clip => clip.OnDestroy());
            ForeachMark(mark => mark.OnDestroy());

            childs = null;
            marks  = null;
            parent = null;
            clips  = null;
            mode   = 0;
            if (mixs != null)
            {
                for (int i = 0; i < mixs.Count; i++)
                {
                    SharedPool <MixClip> .Return(mixs[i]);
                }
                mixs.Clear();
                mixs = null;
            }
        }
Example #16
0
        public override IClip BuildClip(ClipData data)
        {
            var clip = SharedPool <XAnimationClip> .Get();

            clip.data  = (AnimClipData)data;
            clip.track = this;
            clip.Initial(data, idx);
            if (tmp > 0 && clip.start < tmp)
            {
                float start = clip.start;
                if (tmp > clip.end)
                {
                    tmp = clip.end - 0.01f;
                }
                float duration = tmp - start;
                BuildMix(start, duration, clips[idx - 1], clip);
            }
            tmp = clip.end;
            idx++;
            return(clip);
        }
Example #17
0
 public static void DestroyGameObject(string path, GameObject go)
 {
     if (Application.isPlaying)
     {
         Object.Destroy(go);
     }
     else
     {
         Object.DestroyImmediate(go);
     }
     if (goPool.ContainsKey(path))
     {
         var it = goPool[path];
         it.refence--;
         if (it.refence <= 0)
         {
             goPool.Remove(path);
             SharedPool<Asset>.Return(it);
         }
     }
 }
Example #18
0
        public static GameObject LoadGameObject(string path)
        {
#if UNITY_EDITOR
            if (goPool.ContainsKey(path))
            {
                return Object.Instantiate((GameObject) goPool[path].asset);
            }
            else
            {
                var obj = AssetDatabase.LoadAssetAtPath<GameObject>(path);
                if (obj)
                {
                    var tmp = SharedPool<Asset>.Get();
                    tmp.asset = obj;
                    goPool.Add(path, tmp);
                    return Object.Instantiate(obj);
                }
                return null;
            }
#else
        // assetbundle implements 
#endif
        }
Example #19
0
        public override void OnDestroy()
        {
            SharedPool <XLogicClip> .Return(this);

            base.OnDestroy();
        }
Example #20
0
        public override void OnDestroy()
        {
            SharedPool <XBoneFxTrack> .Return(this);

            base.OnDestroy();
        }
Example #21
0
        public override void OnDestroy()
        {
            SharedPool <XActiveMark> .Return(this);

            base.OnDestroy();
        }
Example #22
0
        public override void OnDestroy()
        {
            SharedPool <XJumpMarker> .Return(this);

            base.OnDestroy();
        }
Example #23
0
        public override void OnDestroy()
        {
            SharedPool <XPostprocessTrack> .Return(this);

            base.OnDestroy();
        }
Example #24
0
 public override void OnDestroy()
 {
     draw?.Destroy();
     base.OnDestroy();
     SharedPool <XLogicTrack> .Return(this);
 }