Exemplo n.º 1
0
        // Token: 0x06000228 RID: 552 RVA: 0x0000ABB4 File Offset: 0x00008DB4
        protected static void SetHideFlagsRecursive(GameObject gameObject)
        {
            gameObject.hideFlags = (HideFlags.DontSaveInEditor | HideFlags.DontSaveInBuild);
            if (!Application.isPlaying)
            {
                gameObject.hideFlags |= HideFlags.HideInHierarchy;
            }
            IEnumerator enumerator = gameObject.transform.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    object    obj       = enumerator.Current;
                    Transform transform = (Transform)obj;
                    ParticlePrefabControl.SetHideFlagsRecursive(transform.gameObject);
                }
            } finally
            {
                System.IDisposable disposable;
                if ((disposable = (enumerator as System.IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        // Token: 0x06000224 RID: 548 RVA: 0x0000AA7C File Offset: 0x00008C7C
        void Initialize(GameObject prefabGameObject
                        , Transform startTransform
                        , Transform endTransform
                        , Vector3 startOffsetInWorld
                        , Vector3 endOffsetInWorld
                        , FxFollowType followType
                        , bool initResetRotate
                        , float realLife
                        , float duration
                        , bool revert
                        , float scaleFactor
                        )
        {
            if (startTransform == null || endTransform == null)
            {
                return;
            }
            if (prefabGameObject == null)
            {
                throw new System.ArgumentNullException("Prefab cannot be null");
            }
            if (this.m_Instance != null)
            {
                Debug.LogWarningFormat("Prefab Control Playable ({0}) has already been initialized with a Prefab ({1}).", new object[]
                {
                    prefabGameObject.name,
                    this.m_Instance.name
                });
            }
            else
            {
                this.m_Instance      = Object.Instantiate <GameObject>(prefabGameObject);
                this.m_Instance.name = prefabGameObject.name + " [Timeline]";
                this.m_Instance.SetActive(false);
                ParticleScaleUtility.ScaleEffectNode(this.m_Instance, scaleFactor);
                this.m_StartTrans = startTransform;
                if (this.m_StartTrans != null)
                {
                    var anim = ParticleCtrlUtilities.FindAnimInParent(m_StartTrans);
                    if (anim != null)
                    {
                        this.m_StartRole = anim.transform;
                    }
                }
                this.m_EndTrans = endTransform;
                if (this.m_EndTrans != null)
                {
                    var anim = ParticleCtrlUtilities.FindAnimInParent(m_EndTrans);
                    if (anim != null)
                    {
                        this.m_EndRole = anim.transform;
                    }
                }
                this.m_StartPosOffsetInWorld = startOffsetInWorld;
                this.m_EndPosOffsetInWorld   = endOffsetInWorld;
                this.m_followType            = followType;
                this.m_initResetRotate       = initResetRotate;
                this.m_realLife = realLife;
                this.m_duration = duration;
                this.m_revert   = revert;
                //float roleScale = 1f;
                if (startTransform != null)
                {
                    var roleAnim = ParticleCtrlUtilities.FindAnimInParent(startTransform);
                    if (roleAnim != null)
                    {
                        this.m_Instance.transform.SetParent(roleAnim.transform.parent);
                        //roleScale = roleAnim.transform.lossyScale.x;
                    }
                }
                //ParticleScaleUtility.ScaleEffectNode(this.m_Instance, scaleFactor * roleScale);
                //if (m_ParentTrans != null)
                //{
                //    m_Instance.transform.position = m_ParentTrans.position + m_PosOffsetInWorld;
                //    if( initResetRotate)
                //        m_Instance.transform.rotation = Quaternion.identity;
                //    else
                //        m_Instance.transform.rotation = m_ParentTrans.rotation;
                //    m_Instance.transform.localScale = m_ParentTrans.lossyScale;
                //} else
                //{
                //    m_Instance.transform.position = m_PosOffsetInWorld;
                //    m_Instance.transform.rotation = Quaternion.identity;
                //    m_Instance.transform.localScale = Vector3.one;
                //}

                ParticlePrefabControl.SetHideFlagsRecursive(this.m_Instance);
            }
        }