Simplified

This commit is contained in:
MrGadget1024 2023-03-12 09:33:12 -04:00
parent 98b8227a63
commit 0d8d438d6b
2 changed files with 5 additions and 11 deletions

View File

@ -130,10 +130,12 @@ public static double TimelineClamp(
// outside of the area, we clamp. // outside of the area, we clamp.
double lowerBound = targetTime - bufferTime; double lowerBound = targetTime - bufferTime;
double upperBound = targetTime + bufferTime; double upperBound = targetTime + bufferTime;
#if !UNITY_2021_OR_NEWER #if UNITY_2021_OR_NEWER
return Extensions.Clamp(localTimeline, lowerBound, upperBound);
#else
return Math.Clamp(localTimeline, lowerBound, upperBound); return Math.Clamp(localTimeline, lowerBound, upperBound);
#else
if (localTimeline.CompareTo(lowerBound) < 0) return lowerBound;
else if (localTimeline.CompareTo(upperBound) > 0) return upperBound;
else return localTimeline;
#endif #endif
} }

View File

@ -59,14 +59,6 @@ public static bool TryDequeue<T>(this Queue<T> source, out T element)
element = default; element = default;
return false; return false;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static T Clamp<T>(this T val, T min, T max) where T : IComparable<T>
{
if (val.CompareTo(min) < 0) return min;
else if (val.CompareTo(max) > 0) return max;
else return val;
}
#endif #endif
} }
} }