예제 #1
0
        /// <summary>
        /// 计算Tween的总共持续时间
        /// </summary>
        /// <param name="tween"></param>
        /// <returns></returns>
        private float CalFullTimeOfTween(ActionTween tween)
        {
            float durationTime = tween.GetCalDurationTime();

            if (tween.mActionType == ActionEnum.ActionType.Loop || tween.mActionType == ActionEnum.ActionType.Pingpang)
            {
                if (tween.mLoopTime == -1 || tween.mLoopTime == 0)
                {
                    return(durationTime);
                }
                else
                {
                    return(durationTime * tween.mLoopTime);
                }
            }
            return(durationTime);
        }
예제 #2
0
        /// <summary>
        /// 添加动画Tween到序列指定时间点beginTimePos
        /// </summary>
        /// <param name="beginTimePos">时间点</param>
        /// <param name="tween">添加的动画</param>
        /// <returns></returns>
        public SequenceAction Add(float beginTimePos, ActionTween tween)
        {
            tween.mAutoKill = false;
            tween.mAutoPlay = false;
            ActionTweenManager.Instance.Remove(tween);
            SequenceTweenProperty stp;

            stp.m_IsPlay      = false;
            stp.m_ActionTween = tween;
            stp.m_BeginTime   = beginTimePos;
            stp.m_EndTime     = beginTimePos + CalFullTimeOfTween(tween);
            //stp.m_BeginPercent = beginTimePos / mDuration;
            m_SequenceTweens.Add(stp);

            if (m_DurationFullTime < stp.m_EndTime)
            {
                m_DurationFullTime = stp.m_EndTime;
            }
            return(this);
        }
예제 #3
0
 /// <summary>
 /// 每次Loop完回调一次,最后一次循环不会触发此函数,直接触发OnComplete函数
 /// </summary>
 /// <param name="tween"></param>
 /// <param name="callback"></param>
 /// <returns></returns>
 public static ActionTween SetLoopCompleteCallback(this ActionTween tween, ActionTweenCallback callback)
 {
     tween.mOnLoopComplete = callback;
     return(tween);
 }
예제 #4
0
 /// <summary>
 /// 每帧更新的时候调用,尽量不要在这个函数内调用过度消耗性能的方法
 /// </summary>
 /// <param name="tween"></param>
 /// <param name="callback"></param>
 /// <returns></returns>
 public static ActionTween SetStepUpdateCallback(this ActionTween tween, ActionTweenCallback callback)
 {
     tween.mOnStepUpdate = callback;
     return(tween);
 }
예제 #5
0
 /// <summary>
 /// 动画被杀死时回调
 /// </summary>
 /// <param name="tween"></param>
 /// <param name="callback"></param>
 /// <returns></returns>
 public static ActionTween SetKillCallback(this ActionTween tween, ActionTweenCallback callback)
 {
     tween.mOnKill = callback;
     return(tween);
 }
예제 #6
0
 /// <summary>
 /// 动画开始的时候回调函数
 /// </summary>
 /// <param name="tween"></param>
 /// <param name="callback"></param>
 /// <returns></returns>
 public static ActionTween SetBeginPlayCallback(this ActionTween tween, ActionTweenCallback callback)
 {
     tween.mOnBeginPlay = callback;
     return(tween);
 }
예제 #7
0
 /// <summary>
 /// 设置动画曲线
 /// </summary>
 /// <param name="tween"></param>
 /// <param name="curve"></param>
 /// <returns></returns>
 public static ActionTween SetAnimCurve(this ActionTween tween, AnimationCurve curve)
 {
     tween.mActionCurve = curve;
     return(tween);
 }
예제 #8
0
 /// <summary>
 /// 添加动作进入缓存
 /// </summary>
 /// <param name="actionTween"></param>
 public void Add(ActionTween actionTween)
 {
     mWillAddTweens.Add(actionTween);
 }
예제 #9
0
 /// <summary>
 /// 是否启动速度来运行动画
 /// </summary>
 /// <param name="tween"></param>
 /// <param name="useSpeed"></param>
 /// <returns></returns>
 public static ActionTween SetSpeedAble(this ActionTween tween, bool useSpeed)
 {
     tween.mUseSpeed = useSpeed;
     return(tween);
 }
예제 #10
0
 /// <summary>
 /// 设置动画类型
 /// </summary>
 /// <param name="tween"></param>
 /// <param name="actionType"></param>
 /// <returns></returns>
 public static ActionTween SetActionType(this ActionTween tween, ActionEnum.ActionType actionType)
 {
     tween.mActionType = actionType;
     return(tween);
 }
예제 #11
0
 /// <summary>
 /// 设置循环次数
 /// </summary>
 /// <param name="tween"></param>
 /// <param name="loopTime"></param>
 /// <returns></returns>
 public static ActionTween SetLoopTime(this ActionTween tween, int loopTime)
 {
     tween.mLoopTime = loopTime;
     return(tween);
 }
예제 #12
0
 /// <summary>
 /// 设置此动画的时间缩放
 /// </summary>
 /// <param name="tween"></param>
 /// <param name="scaleTime"></param>
 /// <returns></returns>
 public static ActionTween SetActionScaleTime(this ActionTween tween, float scaleTime)
 {
     tween.mScaleTime = scaleTime;
     return(tween);
 }
예제 #13
0
 /// <summary>
 /// 设置运动方向
 /// </summary>
 /// <param name="tween"></param>
 /// <param name="direction"></param>
 /// <returns></returns>
 public static ActionTween SetActionDirectionType(this ActionTween tween, ActionEnum.ActionDirectionType direction)
 {
     tween.mActionDirectionType = direction;
     return(tween);
 }
예제 #14
0
 /// <summary>
 /// 设置自动Kill
 /// </summary>
 /// <param name="tween"></param>
 /// <returns></returns>
 public static ActionTween SetAutoKill(this ActionTween tween, bool autoKill)
 {
     tween.mAutoKill = autoKill;
     return(tween);
 }
예제 #15
0
 /// <summary>
 /// 设置速度
 /// </summary>
 /// <param name="tween"></param>
 /// <param name="speed"></param>
 /// <returns></returns>
 public static ActionTween SetSpeed(this ActionTween tween, float speed)
 {
     tween.mSpeed = speed;
     return(tween);
 }
예제 #16
0
 /// <summary>
 /// 添加动画在序列末尾
 /// </summary>
 /// <param name="tween"></param>
 /// <returns></returns>
 public SequenceAction Append(ActionTween tween)
 {
     return(Add(m_DurationFullTime, tween));
 }
예제 #17
0
 /// <summary>
 /// 是否采用相对关系
 /// </summary>
 /// <param name="tween"></param>
 /// <param name="isRelative"></param>
 /// <returns></returns>
 public static ActionTween SetRelative(this ActionTween tween, bool isRelative)
 {
     tween.mRelative = isRelative;
     return(tween);
 }
예제 #18
0
 private void MakeForKilling(ActionTween t)
 {
     t.mKill = true;
     mWillKillTweens.Add(t);
 }
예제 #19
0
 /// <summary>
 /// 设置是否自动播放
 /// </summary>
 /// <param name="tween"></param>
 /// <param name="autoPlay"></param>
 /// <returns></returns>
 public static ActionTween SetAutoPlay(this ActionTween tween, bool autoPlay)
 {
     tween.ActionActive = autoPlay;
     tween.mAutoPlay    = autoPlay;
     return(tween);
 }
예제 #20
0
 /// <summary>
 /// 删除缓存里的动作
 /// </summary>
 /// <param name="actionTween"></param>
 public void Remove(ActionTween actionTween)
 {
     mWillRemoveTweens.Add(actionTween);
 }
예제 #21
0
 /// <summary>
 /// 设置缓冲动作
 /// </summary>
 /// <param name="tween"></param>
 /// <param name="ease"></param>
 /// <returns></returns>
 public static ActionTween SetEase(this ActionTween tween, EaseEnum ease)
 {
     tween.mEaseEnum = ease;
     return(tween);
 }