예제 #1
0
파일: TrackAsset.cs 프로젝트: 0geova0/Jam
        /// <summary>
        /// Called by the Timeline Editor to gather properties requiring preview.
        /// </summary>
        /// <param name="director">The PlayableDirector invoking the preview</param>
        /// <param name="driver">PropertyCollector used to gather previewable properties</param>
        public virtual void GatherProperties(PlayableDirector director, IPropertyCollector driver)
        {
            // only push on game objects if there is a binding. Subtracks
            //  will use objects on the stack
            var gameObject = GetGameObjectBinding(director);
            if (gameObject != null)
                driver.PushActiveGameObject(gameObject);

            if (hasCurves)
                driver.AddObjectProperties(this, m_Curves);

            foreach (var clip in clips)
            {
                if (clip.curves != null && clip.asset != null)
                    driver.AddObjectProperties(clip.asset, clip.curves);

                IPropertyPreview modifier = clip.asset as IPropertyPreview;
                if (modifier != null)
                    modifier.GatherProperties(director, driver);
            }

            foreach (var subtrack in GetChildTracks())
            {
                if (subtrack != null)
                    subtrack.GatherProperties(director, driver);
            }

            if (gameObject != null)
                driver.PopActiveGameObject();
        }
예제 #2
0
 public void GatherProperties(PlayableDirector director, IPropertyCollector driver)
 {
     if (!(director == null))
     {
         if (!ControlPlayableAsset.s_ProcessedDirectors.Contains(director))
         {
             ControlPlayableAsset.s_ProcessedDirectors.Add(director);
             GameObject gameObject = this.sourceGameObject.Resolve(director);
             if (gameObject != null)
             {
                 if (this.updateParticle)
                 {
                     foreach (ParticleSystem particleSystem in this.GetComponent <ParticleSystem>(gameObject))
                     {
                         driver.AddFromName <ParticleSystem>(particleSystem.gameObject, "randomSeed");
                         driver.AddFromName <ParticleSystem>(particleSystem.gameObject, "autoRandomSeed");
                     }
                 }
                 if (this.active)
                 {
                     driver.AddFromName(gameObject, "m_IsActive");
                 }
                 if (this.updateITimeControl)
                 {
                     foreach (MonoBehaviour monoBehaviour in ControlPlayableAsset.GetControlableScripts(gameObject))
                     {
                         IPropertyPreview propertyPreview = monoBehaviour as IPropertyPreview;
                         if (propertyPreview != null)
                         {
                             propertyPreview.GatherProperties(director, driver);
                         }
                         else
                         {
                             driver.AddFromComponent(monoBehaviour.gameObject, monoBehaviour);
                         }
                     }
                 }
                 if (this.updateDirector)
                 {
                     foreach (PlayableDirector playableDirector in this.GetComponent <PlayableDirector>(gameObject))
                     {
                         if (!(playableDirector == null))
                         {
                             TimelineAsset timelineAsset = playableDirector.playableAsset as TimelineAsset;
                             if (!(timelineAsset == null))
                             {
                                 timelineAsset.GatherProperties(playableDirector, driver);
                             }
                         }
                     }
                 }
             }
             ControlPlayableAsset.s_ProcessedDirectors.Remove(director);
         }
     }
 }
예제 #3
0
        public void GatherProperties(PlayableDirector director, IPropertyCollector driver)
        {
            GameObject gameObject = GetGameObjectBinding(director);

            if (!gameObject)
            {
                return;
            }

            if (this.updateParticle)
            {
                foreach (ParticleSystem particleSystem in this.GetParticleSystems(gameObject))
                {
                    driver.AddFromName <ParticleSystem>(particleSystem.gameObject, "randomSeed");
                    driver.AddFromName <ParticleSystem>(particleSystem.gameObject, "autoRandomSeed");
                }
            }
            if (this.active)
            {
                driver.AddFromName(gameObject, "m_IsActive");
            }
            if (this.updateITimeControl)
            {
                foreach (MonoBehaviour controlableScript in this.GetControlableScripts(gameObject))
                {
                    IPropertyPreview propertyPreview = controlableScript as IPropertyPreview;
                    if (propertyPreview != null)
                    {
                        propertyPreview.GatherProperties(director, driver);
                    }
                    else
                    {
                        driver.AddFromComponent(controlableScript.gameObject, (Component)controlableScript);
                    }
                }
            }
        }
예제 #4
0
        public virtual void GatherProperties(PlayableDirector director, IPropertyCollector driver)
        {
            GameObject gameObjectBinding = this.GetGameObjectBinding(director);

            if (gameObjectBinding != null)
            {
                driver.PushActiveGameObject(gameObjectBinding);
            }
            if (this.animClip != null)
            {
                driver.AddFromClip(this.animClip);
            }
            foreach (TimelineClip timelineClip in this.clips)
            {
                if (timelineClip.curves != null && timelineClip.asset != null)
                {
                    driver.AddObjectProperties(timelineClip.asset, timelineClip.curves);
                }
                IPropertyPreview propertyPreview = timelineClip.asset as IPropertyPreview;
                if (propertyPreview != null)
                {
                    propertyPreview.GatherProperties(director, driver);
                }
            }
            foreach (TrackAsset trackAsset in this.GetChildTracks())
            {
                if (trackAsset != null)
                {
                    trackAsset.GatherProperties(director, driver);
                }
            }
            if (gameObjectBinding != null)
            {
                driver.PopActiveGameObject();
            }
        }