using Unity.Jobs; using Unity.Mathematics; using UnityEngine; using LitMotion; using LitMotion.Adapters; [assembly: RegisterGenericJobType(typeof(MotionUpdateJob))] [assembly: RegisterGenericJobType(typeof(MotionUpdateJob))] [assembly: RegisterGenericJobType(typeof(MotionUpdateJob))] [assembly: RegisterGenericJobType(typeof(MotionUpdateJob))] [assembly: RegisterGenericJobType(typeof(MotionUpdateJob))] [assembly: RegisterGenericJobType(typeof(MotionUpdateJob))] namespace LitMotion.Adapters { public readonly struct Vector2MotionAdapter : IMotionAdapter { public Vector2 Evaluate(ref Vector2 startValue, ref Vector2 endValue, ref NoOptions options, in MotionEvaluationContext context) { return Vector2.LerpUnclamped(startValue, endValue, context.Progress); } } public readonly struct Vector3MotionAdapter : IMotionAdapter { public Vector3 Evaluate(ref Vector3 startValue, ref Vector3 endValue, ref NoOptions options, in MotionEvaluationContext context) { return Vector3.LerpUnclamped(startValue, endValue, context.Progress); } } public readonly struct Vector4MotionAdapter : IMotionAdapter { public Vector4 Evaluate(ref Vector4 startValue, ref Vector4 endValue, ref NoOptions options, in MotionEvaluationContext context) { return Vector4.LerpUnclamped(startValue, endValue, context.Progress); } } public readonly struct QuaternionMotionAdapter : IMotionAdapter { public Quaternion Evaluate(ref Quaternion startValue, ref Quaternion endValue, ref NoOptions options, in MotionEvaluationContext context) { return Quaternion.LerpUnclamped(startValue, endValue, context.Progress); } } public readonly struct ColorMotionAdapter : IMotionAdapter { public Color Evaluate(ref Color startValue, ref Color endValue, ref NoOptions options, in MotionEvaluationContext context) { return Color.LerpUnclamped(startValue, endValue, context.Progress); } } public readonly struct RectMotionAdapter : IMotionAdapter { public Rect Evaluate(ref Rect startValue, ref Rect endValue, ref NoOptions options, in MotionEvaluationContext context) { var x = math.lerp(startValue.x, endValue.x, context.Progress); var y = math.lerp(startValue.y, endValue.y, context.Progress); var width = math.lerp(startValue.width, endValue.width, context.Progress); var height = math.lerp(startValue.height, endValue.height, context.Progress); return new Rect(x, y, width, height); } } }