change to state machine
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
public static class AAssist
|
||||
{
|
||||
// Bản generic (giống template C++)
|
||||
public static void a_ClampRoof<T>(ref T x, T max) where T : System.IComparable<T>
|
||||
{
|
||||
if (x.CompareTo(max) > 0) x = max;
|
||||
}
|
||||
|
||||
// Tiện dụng cho float (Unity)
|
||||
public static void a_ClampRoof(ref float x, float max)
|
||||
{
|
||||
if (x > max) x = max;
|
||||
}
|
||||
|
||||
// (Tuỳ chọn) giữ luôn 2 hàm “họ hàng” như trong header gốc:
|
||||
public static void a_ClampFloor<T>(ref T x, T min) where T : System.IComparable<T>
|
||||
{
|
||||
if (x.CompareTo(min) < 0) x = min;
|
||||
}
|
||||
public static void a_Clamp<T>(ref T x, T min, T max) where T : System.IComparable<T>
|
||||
{
|
||||
if (x.CompareTo(min) < 0) x = min;
|
||||
if (x.CompareTo(max) > 0) x = max;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user