public static void AddKeyFrameToCurve(AnimationCurve curve, float time, float framerate, float value, bool stepped)
        {
            Keyframe keyframe = default(Keyframe);
            bool     flag     = true;
            int      num      = CurveEditUtility.GetKeyframeAtTime(curve, time, framerate);

            if (num != -1)
            {
                flag     = false;
                keyframe = curve.get_Item(num);
                curve.RemoveKey(num);
            }
            keyframe.set_value(value);
            keyframe.set_time(CurveEditUtility.GetKeyTime(time, framerate));
            num = curve.AddKey(keyframe);
            if (stepped)
            {
                AnimationUtility.SetKeyBroken(curve, num, stepped);
                AnimationUtility.SetKeyLeftTangentMode(curve, num, 3);
                AnimationUtility.SetKeyRightTangentMode(curve, num, 3);
                keyframe.set_outTangent(float.PositiveInfinity);
                keyframe.set_inTangent(float.PositiveInfinity);
            }
            else if (flag)
            {
                AnimationUtility.SetKeyLeftTangentMode(curve, num, 4);
                AnimationUtility.SetKeyRightTangentMode(curve, num, 4);
            }
            if (num != -1 && !stepped)
            {
                AnimationUtility.UpdateTangentsFromModeSurrounding(curve, num);
                AnimationUtility.SetKeyBroken(curve, num, false);
            }
        }