using System; using UnityEngine; [Serializable] public class animation_curve_math_class { public virtual AnimationCurve set_curve_linear(AnimationCurve curve) { AnimationCurve animationCurve = new AnimationCurve(); for (int i = 0; i < curve.keys.Length; i++) { float inTangent = 0f; float outTangent = 0f; bool flag = false; bool flag2 = false; Vector2 vector = default(Vector2); Vector2 vector2 = default(Vector2); Vector2 vector3 = default(Vector2); Keyframe key = curve[i]; if (i == 0) { inTangent = 0f; flag = true; } if (i == curve.keys.Length - 1) { outTangent = 0f; flag2 = true; } if (!flag) { vector.x = curve.keys[i - 1].time; vector.y = curve.keys[i - 1].value; vector2.x = curve.keys[i].time; vector2.y = curve.keys[i].value; vector3 = vector2 - vector; inTangent = vector3.y / vector3.x; } if (!flag2) { vector.x = curve.keys[i].time; vector.y = curve.keys[i].value; vector2.x = curve.keys[i + 1].time; vector2.y = curve.keys[i + 1].value; vector3 = vector2 - vector; outTangent = vector3.y / vector3.x; } key.inTangent = inTangent; key.outTangent = outTangent; animationCurve.AddKey(key); } return animationCurve; } }