mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Simplified
This commit is contained in:
parent
98b8227a63
commit
0d8d438d6b
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user