Ejemplo n.º 1
0
 protected override void UpdateValue(float proc, float deltaTime)
 {
     for (int i = 0; i < m_SequenceTweens.Count; i++)
     {
         SequenceTweenProperty  stp   = m_SequenceTweens[i];
         ActionEnum.ActionState state = currentActionState;
         if (state == ActionEnum.ActionState.Action)
         {
             if (GetCurrentUpdateTime() >= stp.m_BeginTime && GetCurrentUpdateTime() <= stp.m_EndTime)
             {
                 if (!stp.m_IsPlay)
                 {
                     stp.m_IsPlay = true;
                     stp.m_ActionTween.ActionActive = true;
                     m_SequenceTweens[i]            = stp;
                     stp.m_ActionTween.Play();
                 }
             }
             else if (GetCurrentUpdateTime() > stp.m_EndTime || GetCurrentUpdateTime() < stp.m_BeginTime)
             {
                 if (stp.m_IsPlay)
                 {
                     stp.m_IsPlay = false;
                     stp.m_ActionTween.ActionActive = false;
                     m_SequenceTweens[i]            = stp;
                 }
             }
         }
         else if (state == ActionEnum.ActionState.Revert)
         {
             if (GetCurrentUpdateTime() >= stp.m_BeginTime && GetCurrentUpdateTime() <= stp.m_EndTime)
             {
                 if (!stp.m_IsPlay)
                 {
                     stp.m_IsPlay = true;
                     stp.m_ActionTween.ActionActive = true;
                     m_SequenceTweens[i]            = stp;
                     stp.m_ActionTween.Revert();
                 }
             }
             else if (GetCurrentUpdateTime() > stp.m_EndTime || GetCurrentUpdateTime() < stp.m_BeginTime)
             {
                 if (stp.m_IsPlay)
                 {
                     stp.m_IsPlay = false;
                     stp.m_ActionTween.ActionActive = false;
                     m_SequenceTweens[i]            = stp;
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
        ///// <summary>
        ///// 计算速度 //TODO 没用的东西
        ///// </summary>
        ///// <returns></returns>
        //private float CalSpeed()
        //{
        //    if (mUseSpeed && mSpeed > 0)
        //    {
        //        return mSpeed;
        //    }
        //    else
        //    {
        //        if (!mIsSpeedInit)
        //        {
        //            mSpeed = mDuration == 0 ? 9999999.0f : (1.0f / mDuration);
        //            mIsSpeedInit = true;
        //        }
        //        return mSpeed;
        //    }
        //}

        /// <summary>
        /// 解析动画类型,分析动画按照何种方式运行,返回False,动画执行完毕,True则需要继续处理动画类型解析
        /// </summary>
        /// <param name="actionType"></param>
        /// <param name="actionState"></param>
        /// <returns></returns>
        private bool ParseActionType(ActionEnum.ActionType actionType, ActionEnum.ActionState actionState)
        {
            switch (actionType)
            {
            case ActionEnum.ActionType.Loop:
                mHasUpdateTime = 0;
                ++mTempLoopTime;
                bool isLoopFinish = mLoopTime == -1 ? true : mTempLoopTime < mLoopTime;
                if (isLoopFinish)
                {
                    if (mOnLoopComplete != null)
                    {
                        OnTweenCallback(mOnLoopComplete);
                    }
                }
                return(isLoopFinish);

            case ActionEnum.ActionType.Pingpang:
                if (actionState == ActionEnum.ActionState.Action)
                {
                    ChangedActionState(ActionEnum.ActionState.Revert);
                    return(true);
                }
                else if (actionState == ActionEnum.ActionState.Revert)
                {
                    mHasUpdateTime = 0;
                    ++mTempLoopTime;
                    bool isPingpangLoopFinish = mLoopTime == -1 ? true : mTempLoopTime < mLoopTime;
                    if (isPingpangLoopFinish)
                    {
                        ChangedActionState(ActionEnum.ActionState.Action);
                        if (mOnLoopComplete != null)
                        {
                            OnTweenCallback(mOnLoopComplete);
                        }
                    }
                    return(isPingpangLoopFinish);
                }
                break;

            case ActionEnum.ActionType.None:
            default:
                return(false);
            }
            return(false);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 改变动态运行状态
 /// </summary>
 /// <param name="state"></param>
 private void ChangedActionState(ActionEnum.ActionState state)
 {
     mActionState = state;
 }