示例#1
0
        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
        {
            if (m_Instance == null)
            {
                return;
            }
            if (m_revert)
            {
                if ((m_followType & FxFollowType.followPos) > 0 && m_EndTrans != null)
                {
                    m_EndWorldPos = ParticleCtrlUtilities.CalcNodeTransPos(m_EndRole, m_EndTrans, m_EndPosOffsetInWorld);
                }
                if (m_StartTrans != null)
                {
                    m_StartWorldPos = ParticleCtrlUtilities.CalcNodeTransPos(m_StartRole, m_StartTrans, m_StartPosOffsetInWorld);
                }
            }
            else
            {
                if ((m_followType & FxFollowType.followPos) > 0 && m_StartTrans != null)
                {
                    m_StartWorldPos = ParticleCtrlUtilities.CalcNodeTransPos(m_StartRole, m_StartTrans, m_StartPosOffsetInWorld);
                }
                if (m_EndTrans != null)
                {
                    m_EndWorldPos = ParticleCtrlUtilities.CalcNodeTransPos(m_EndRole, m_EndTrans, m_EndPosOffsetInWorld);
                }
            }

            var pct = GetPercent(playable);

            m_Instance.transform.position = Vector3.Lerp(m_StartWorldPos, m_EndWorldPos, pct);
        }
示例#2
0
        // Token: 0x06000226 RID: 550 RVA: 0x0000AB69 File Offset: 0x00008D69
        public override void OnBehaviourPlay(Playable playable, FrameData info)
        {
            if (this.m_Instance != null)
            {
                this.m_Instance.SetActive(true);
                if (m_ParentTrans != null)
                {
                    m_Instance.transform.position =
                        ParticleCtrlUtilities.CalcNodeTransPos(
                            m_Instance.transform.parent, m_ParentTrans
                            , m_PosOffsetInWorld);
                    if (m_initResetRotate)
                    {
                        //try find CharactorRoot
                        var anim = ParticleCtrlUtilities.FindAnimInParent(m_ParentTrans);
                        if (anim != null)
                        {
                            m_Instance.transform.rotation = anim.transform.rotation;
                        }
                        else
                        {
                            m_Instance.transform.localRotation = 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;
                }
                initWorldPos    = m_Instance.transform.position;
                initWorldRotate = m_Instance.transform.rotation;

                var helper = m_Instance.GetComponent <TimelineFollowTranHelper>();
                if (helper == null)
                {
                    helper = m_Instance.AddComponent <TimelineFollowTranHelper>();
                }
                helper.m_ParentTrans      = m_ParentTrans;
                helper.m_followType       = m_followType;
                helper.m_PosOffsetInWorld = m_PosOffsetInWorld;
                helper.initWorldPos       = initWorldPos;
                helper.initWorldRotate    = initWorldRotate;
            }
        }
示例#3
0
 // Called each frame while the state is set to Play
 public override void PrepareFrame(Playable playable, FrameData info)
 {
     if (m_ParentTrans == null || followType == FxFollowType.none)
     {
         return;
     }
     if ((followType & FxFollowType.followPos) > 0)
     {
         m_Instance.transform.position = ParticleCtrlUtilities.CalcNodeTransPos(m_Instance.transform.parent, m_ParentTrans, posOffset);
     }
     if ((followType & FxFollowType.followRotate) > 0)
     {
         m_Instance.transform.rotation = m_ParentTrans.rotation;
     }
 }
示例#4
0
 private void LateUpdate()
 {
     if (m_ParentTrans == null || m_followType == FxFollowType.none)
     {
         transform.position = initWorldPos;
         transform.rotation = initWorldRotate;
         return;
     }
     if ((m_followType & FxFollowType.followPos) > 0)
     {
         transform.position = ParticleCtrlUtilities.CalcNodeTransPos(transform.parent, m_ParentTrans, m_PosOffsetInWorld);
     }
     if ((m_followType & FxFollowType.followRotate) > 0)
     {
         transform.rotation = m_ParentTrans.rotation;
     }
 }
示例#5
0
        // Token: 0x06000226 RID: 550 RVA: 0x0000AB69 File Offset: 0x00008D69
        public override void OnBehaviourPlay(Playable playable, FrameData info)
        {
            if (this.m_Instance != null)
            {
                this.m_Instance.SetActive(true);
                if (m_StartTrans != null)
                {
                    //m_Instance.transform.localScale = m_StartTrans.lossyScale;
                    m_StartWorldPos = ParticleCtrlUtilities.CalcNodeTransPos(m_StartRole, m_StartTrans, m_StartPosOffsetInWorld);
                }
                else
                {
                    m_StartWorldPos = m_StartPosOffsetInWorld;
                    m_Instance.transform.position = m_StartPosOffsetInWorld;
                    m_Instance.transform.rotation = Quaternion.identity;
                    //m_Instance.transform.localScale = Vector3.one;
                }

                if (m_EndTrans != null)
                {
                    m_EndWorldPos = ParticleCtrlUtilities.CalcNodeTransPos(m_EndRole, m_EndTrans, m_EndPosOffsetInWorld);
                }
                else
                {
                    m_EndWorldPos = m_EndPosOffsetInWorld;
                }

                if (m_revert)
                {
                    m_Instance.transform.position = m_EndWorldPos;
                }
                else
                {
                    m_Instance.transform.position = m_StartWorldPos;
                }
                m_Instance.transform.forward = CalcDirection();
            }
        }
示例#6
0
 // Update is called once per frame
 void LateUpdate()
 {
     CalcPct();
     if (lifePct > 1f)
     {
         if (destory)
         {
             GameObject.Destroy(gameObject);
         }
         else
         {
             gameObject.SetActive(false);
         }
     }
     else if (TargetTrans != null)
     {
         transform.position = Vector3.Lerp(startPos, TargetTrans.position, flyPct);
     }
     else
     {
         if (followTrans == null || followType == FxFollowType.none)
         {
             transform.position = posOffset;
             transform.rotation = rotateOffset;
             return;
         }
         if ((followType & FxFollowType.followPos) > 0)
         {
             transform.position = ParticleCtrlUtilities.CalcNodeTransPos(transform.parent, followTrans, posOffset);
         }
         if ((followType & FxFollowType.followRotate) > 0)
         {
             transform.rotation = followTrans.rotation;
         }
     }
 }
示例#7
0
        // Called when the state of the playable is set to Play
        public override void OnBehaviourPlay(Playable playable, FrameData info)
        {
            if (m_Instance == null)
            {
                this.m_Instance = fxGo;
                //if (!this.m_Instance.activeInHierarchy)
                //{
                //    this.m_Instance.SetActive(true);
                //}
                //this.m_Instance.name = prefabGameObject.name + " [Timeline]";
                //this.m_Instance.SetActive(false);
                //float roleScale = 1f;
                m_ParentTrans = (sourceGameObject == null) ? null : sourceGameObject.transform;
                //if (m_ParentTrans != null)
                //{
                //    var roleAnim = ParticleCtrlUtilities.FindAnimInParent(m_ParentTrans);

                //    //if (roleAnim != null)
                //    //{
                //    //    roleScale = roleAnim.transform.lossyScale.x;
                //    //}
                //}
                //ParticleScaleUtility.ScaleEffectNode(this.m_Instance, scaleFactor * roleScale);
            }

            if (this.m_Instance != null)
            {
                this.m_Instance.SetActive(true);
                if (m_ParentTrans != null)
                {
                    m_Instance.transform.position = ParticleCtrlUtilities.CalcNodeTransPos(m_Instance.transform.parent, m_ParentTrans, posOffset);
                    if (initResetRotate)
                    {
                        var anim = ParticleCtrlUtilities.FindAnimInParent(m_ParentTrans);
                        if (anim != null)
                        {
                            m_Instance.transform.rotation = anim.transform.rotation;
                        }
                        else
                        {
                            m_Instance.transform.localRotation = Quaternion.identity;
                        }
                    }
                    else
                    {
                        m_Instance.transform.rotation = m_ParentTrans.rotation;
                    }
                }
                else
                {
                    m_Instance.transform.position = posOffset;
                    m_Instance.transform.rotation = Quaternion.identity;
                }
                var particles = m_Instance.GetComponentsInChildren <ParticleSystem>(true);
                if (particles != null && particles.Length > 0)
                {
                    foreach (var p in particles)
                    {
                        p.Simulate(clipIn, false, true);
                        p.Play(false);
                    }
                }

                var matAnims = m_Instance.GetComponentsInChildren <FxHelper.FxHelper_MatAnim>(true);
                if (matAnims != null && matAnims.Length > 0)
                {
                    foreach (var a in matAnims)
                    {
                        a.SetTime(clipIn);
                    }
                }
            }
        }