示例#1
0
 public void TranslateCurves(float amount)
 {
     base.Firetime += amount;
     for (int i = 0; i < curveData.Count; i++)
     {
         int curveCount = UnityPropertyTypeInfo.GetCurveCount(curveData[i].PropertyType);
         for (int j = 0; j < curveCount; j++)
         {
             AnimationCurve animationCurve = curveData[i].GetCurve(j);
             if (amount > 0)
             {
                 for (int k = animationCurve.length - 1; k >= 0; k--)
                 {
                     Keyframe kf          = animationCurve.keys[k];
                     Keyframe newKeyframe = new Keyframe(kf.time + amount, kf.value, kf.inTangent, kf.outTangent);
                     newKeyframe.tangentMode = kf.tangentMode;
                     AnimationCurveHelper.MoveKey(animationCurve, k, newKeyframe);
                 }
             }
             else
             {
                 for (int k = 0; k < animationCurve.length; k++)
                 {
                     Keyframe kf          = animationCurve.keys[k];
                     Keyframe newKeyframe = new Keyframe(kf.time + amount, kf.value, kf.inTangent, kf.outTangent);
                     newKeyframe.tangentMode = kf.tangentMode;
                     AnimationCurveHelper.MoveKey(animationCurve, k, newKeyframe);
                 }
             }
         }
     }
 }
示例#2
0
        private void updateKeyframeTime(float oldTime, float newTime)
        {
            for (int i = 0; i < curveData.Count; i++)
            {
                int curveCount = UnityPropertyTypeInfo.GetCurveCount(curveData[i].PropertyType);
                for (int j = 0; j < curveCount; j++)
                {
                    AnimationCurve animationCurve = curveData[i].GetCurve(j);
                    for (int k = 0; k < animationCurve.length; k++)
                    {
                        Keyframe kf = animationCurve.keys[k];

                        if (Mathf.Abs(kf.time - oldTime) < 0.00001)
                        {
                            Keyframe newKeyframe = new Keyframe(newTime, kf.value, kf.inTangent, kf.outTangent);
                            newKeyframe.tangentMode = kf.tangentMode;
                            AnimationCurveHelper.MoveKey(animationCurve, k, newKeyframe);
                        }
                    }
                }
            }
        }