From dc5edaf1025ff4cebaa41eba9a36f854b80d91ec Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 18 Apr 2022 15:48:28 +0800 Subject: *misc --- .../Assets/Test/Scripts/TestMathHelper.cs | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'AlienSurvival/Assets/Test/Scripts/TestMathHelper.cs') diff --git a/AlienSurvival/Assets/Test/Scripts/TestMathHelper.cs b/AlienSurvival/Assets/Test/Scripts/TestMathHelper.cs index e2ca833..239d8ed 100644 --- a/AlienSurvival/Assets/Test/Scripts/TestMathHelper.cs +++ b/AlienSurvival/Assets/Test/Scripts/TestMathHelper.cs @@ -13,4 +13,31 @@ public class TestMathHelper : MonoBehaviour ); } + /// + /// ·µ»Ø½Ç¶È + /// + /// + /// + public static float Angle(Vector2 vector2) + { + return 360 - (Mathf.Atan2(vector2.y, vector2.x) * Mathf.Rad2Deg * Mathf.Sign(vector2.y)); + } + + public static int Check(bool condition) + { + return condition ? 1 : 0; + } + + //public static float Angle(Vector2 vector2) + //{ + // if (vector2.x < 0) + // { + // return 360 - (Mathf.Atan2(vector2.x, vector2.y) * Mathf.Rad2Deg * -1); + // } + // else + // { + // return Mathf.Atan2(vector2.x, vector2.y) * Mathf.Rad2Deg; + // } + //} + } \ No newline at end of file -- cgit v1.1-26-g67d0