소스 검색

[Mono] Make Sign methods consistent with GDScript and System.Math

Aaron Franke 5 년 전
부모
커밋
0b3f1cc70a
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs

+ 4 - 2
modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs

@@ -266,12 +266,14 @@ namespace Godot
 
         public static int Sign(int s)
         {
+            if (s == 0) return 0;
             return s < 0 ? -1 : 1;
         }
 
-        public static real_t Sign(real_t s)
+        public static int Sign(real_t s)
         {
-            return s < 0f ? -1f : 1f;
+            if (s == 0) return 0;
+            return s < 0 ? -1 : 1;
         }
 
         public static real_t Sin(real_t s)