public static float MoveTowardsAngle(float current, float target, float maxDelta) { float num = MathFunc.DeltaAngle(current, target); float result; if (-maxDelta < num && num < maxDelta) { result = target; } else { target = current + num; result = MathFunc.MoveTowards(current, target, maxDelta); } return(result); }