using Unity.Jobs; using UnityEngine; using LitMotion; using LitMotion.Adapters; [assembly: RegisterGenericJobType(typeof(MotionUpdateJob))] [assembly: RegisterGenericJobType(typeof(MotionUpdateJob))] [assembly: RegisterGenericJobType(typeof(MotionUpdateJob))] namespace LitMotion.Adapters { // Note: Punch motion uses startValue as offset and endValue as vibration strength. public readonly struct FloatPunchMotionAdapter : IMotionAdapter { public float Evaluate(ref float startValue, ref float endValue, ref PunchOptions options, in MotionEvaluationContext context) { VibrationHelper.EvaluateStrength(endValue, options.Frequency, options.DampingRatio, context.Progress, out var result); return startValue + result; } } public readonly struct Vector2PunchMotionAdapter : IMotionAdapter { public Vector2 Evaluate(ref Vector2 startValue, ref Vector2 endValue, ref PunchOptions options, in MotionEvaluationContext context) { VibrationHelper.EvaluateStrength(endValue, options.Frequency, options.DampingRatio, context.Progress, out var result); return startValue + result; } } public readonly struct Vector3PunchMotionAdapter : IMotionAdapter { public Vector3 Evaluate(ref Vector3 startValue, ref Vector3 endValue, ref PunchOptions options, in MotionEvaluationContext context) { VibrationHelper.EvaluateStrength(endValue, options.Frequency, options.DampingRatio, context.Progress, out var result); return startValue + result; } } }