change to state machine

This commit is contained in:
VDH
2025-09-08 09:20:50 +07:00
parent 1d7a284aaf
commit ee8b1d6a98
20 changed files with 442 additions and 3 deletions
+25
View File
@@ -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;
}
}