Пример #1
0
        //执行
        public void End()
        {
            if (CurHandle != null)
            {
                CurHandle.OnStart(this);

                //直接设置到结束的,并且需要用当前值作开始值的,这里得计算下当前值,不然下面的Update()计算出来的值可能不正确
                if (m_isUseNowStart && !m_isCatchUseNowStart)
                {
                    if (!ingore)
                    {
                        CurHandle.OnUseNowStart(this);
                    }
                    m_isCatchUseNowStart = true;
                }
                if (!ingore)
                {
                    CurHandle.Update(this, m_animationCurve.Evaluate(1f), false);
                }
                EditorUtil.SetDirty(m_go);
            }

            Clear();
            if (m_onEnd != null)
            {
                m_onEnd();
            }
        }
Пример #2
0
        //设置到某一帧
        public void SetTime(float time, bool ingoreDelay = false, bool stopIfPlay = false, bool endIfOverEnd = false)
        {
            if (ingoreDelay == false && time < m_delay)//还在delay中的话不用做
            {
                return;
            }
            bool isPlaying = IsPlaying;

            CurTime = ingoreDelay ? time + m_delay : time;
            bool isOverEnd = IsOverEnd;

            if (endIfOverEnd && isOverEnd)//已经结束的话,看是不是需要设置为结束
            {
                if (!ingore)
                {
                    CurHandle.Update(this, m_animationCurve.Evaluate(1f), stopIfPlay);
                }
                EditorUtil.SetDirty(m_go);                                  //编辑器下没有运行的时候可能不会刷新,这里手动调用下
            }
            else if (!isOverEnd && CurTime >= m_delay && CurHandle != null) //没有结束而且超过延迟
            {
                if (!ingore)
                {
                    CurHandle.Update(this, m_animationCurve.Evaluate(CurFactor), stopIfPlay);
                }
                EditorUtil.SetDirty(m_go);//编辑器下没有运行的时候可能不会刷新,这里手动调用下
            }


            if (!isPlaying || stopIfPlay)
            {
                Clear();
            }
        }
Пример #3
0
        //设置到某一比例,注意如果这里是循环或者乒乓的话可能会使次数减少,最好用SetTime替代
        public void SetFactor(float factor, bool stopIfPlay = false)
        {
            bool isPlaying = IsPlaying;

            CurFactor = factor;
            if (CurHandle != null)
            {
                if (!ingore)
                {
                    CurHandle.Update(this, m_animationCurve.Evaluate(factor), stopIfPlay);
                }
            }

            if (!isPlaying || stopIfPlay)
            {
                Clear();
            }
        }
Пример #4
0
        //更新
        public void Update()
        {
            if (!IsPlaying)
            {
                return;
            }

            //Debuger.LogError(string.Format("now:{0} curTime:{1}",Now,CurTime));
            if (IsEnd)
            {
                End();
            }
            else
            {
                if (CurTime >= m_delay && CurHandle != null)
                {
                    if (!ingore)
                    {
                        CurHandle.Update(this, m_animationCurve.Evaluate(CurFactor), false);
                    }
                    EditorUtil.SetDirty(m_go);
                }
            }
        }