Пример #1
0
        // Token: 0x060001AE RID: 430 RVA: 0x00008D30 File Offset: 0x00006F30
        protected static void GetParticleSystemRoots(Transform t, ICollection <ParticleSystem> roots)
        {
            ParticleSystem component = t.GetComponent <ParticleSystem>();

            if (component != null)
            {
                roots.Add(component);
            }
            else
            {
                for (int i = 0; i < t.childCount; i++)
                {
                    ParticleControlPlayableAsset.GetParticleSystemRoots(t.GetChild(i), roots);
                }
            }
        }
Пример #2
0
        // Token: 0x060001AD RID: 429 RVA: 0x00008CEC File Offset: 0x00006EEC
        protected IList <ParticleSystem> GetParticleSystemRoots(GameObject go)
        {
            IList <ParticleSystem> result;

            if (this.searchHierarchy)
            {
                List <ParticleSystem> list = new List <ParticleSystem>();
                ParticleControlPlayableAsset.GetParticleSystemRoots(go.transform, list);
                result = list;
            }
            else
            {
                result = this.GetComponent <ParticleSystem>(go);
            }
            return(result);
        }
Пример #3
0
        // Token: 0x060001A3 RID: 419 RVA: 0x00008660 File Offset: 0x00006860
        public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
        {
            if (this.prefabGameObject != null)
            {
                if (s_CreatedPrefabs.Contains(this.prefabGameObject))
                {
                    Debug.LogWarningFormat("Control Track Clip ({0}) is causing a prefab to instantiate itself recursively. Aborting further instances.", new object[]
                    {
                        base.name
                    });
                    return(Playable.Create(graph, 0));
                }
                s_CreatedPrefabs.Add(this.prefabGameObject);
            }
            Playable        playable   = Playable.Null;
            List <Playable> list       = new List <Playable>();
            GameObject      gameObject = this.sourceGameObject.Resolve(graph.GetResolver());

            if (this.prefabGameObject != null)
            {
                Transform parentTransform = (!(gameObject != null)) ? null : gameObject.transform;
                ScriptPlayable <ParticlePrefabControl> playable2 = ParticlePrefabControl.Create(
                    graph, this.prefabGameObject, parentTransform, posOffset, followType, initResetRotate
                    , this.realLife, this.scaleFactor
                    );
                gameObject = playable2.GetBehaviour().prefabInstance;
                list.Add(playable2);
            }
            //this.m_Duration = PlayableBinding.DefaultDuration;

            this.m_SupportLoop = false;
            if (gameObject != null)
            {
                // IList<PlayableDirector> directors = (!this.updateDirector) ? TestControlPlayableAsset.k_EmptyDirectorsList : this.GetComponent<PlayableDirector>(gameObject);
                // IList<ParticleSystem> particleSystems = (!this.updateParticle) ? ParticleControlPlayableAsset.k_EmptyParticlesList : this.GetParticleSystemRoots(gameObject);
                IList <ParticleSystem> particleSystems = ((!this.updateParticle) || (realLife > 0f && Application.isPlaying)) ? ParticleControlPlayableAsset.k_EmptyParticlesList : this.GetParticleSystemRoots(gameObject);
                //this.UpdateDurationAndLoopFlag(directors, particleSystems);
                PlayableDirector component = go.GetComponent <PlayableDirector>();
                if (component != null)
                {
                    this.m_ControlDirectorAsset = component.playableAsset;
                }
                if (go == gameObject && this.prefabGameObject == null)
                {
                    Debug.LogWarningFormat("Control Playable ({0}) is referencing the same PlayableDirector component than the one in which it is playing.", new object[]
                    {
                        base.name
                    });
                    this.active = false;
                    //if (!this.searchHierarchy)
                    //{
                    //    //this.updateDirector = false;
                    //}
                }
                if (this.active && realLife < 0.01f)
                {
                    this.CreateActivationPlayable(gameObject, graph, list);
                }
                //if (this.updateDirector)
                //{
                //    this.SearchHierarchyAndConnectDirector(directors, graph, list, this.prefabGameObject != null);
                //}
                if (this.updateParticle)
                {
                    this.SearchHiearchyAndConnectParticleSystem(particleSystems, graph, list);
                }
                //if (this.updateITimeControl)
                //{
                //    TestControlPlayableAsset.SearchHierarchyAndConnectControlableScripts(TestControlPlayableAsset.GetControlableScripts(gameObject), graph, list);
                //}
                playable = ParticleControlPlayableAsset.ConnectPlayablesToMixer(graph, list);
            }
            if (this.prefabGameObject != null)
            {
                s_CreatedPrefabs.Remove(this.prefabGameObject);
            }
            if (!playable.IsValid <Playable>())
            {
                playable = Playable.Create(graph, 0);
            }
            return(playable);
        }