소스 검색

Merge pull request #71992 from raulsntos/dotnet/rect-alt

C#: Remove `GetArea` and `GetVolume` methods
Rémi Verschelde 2 년 전
부모
커밋
092bbfc2ea

+ 10 - 10
modules/mono/glue/GodotSharp/GodotSharp/Core/Aabb.cs

@@ -49,6 +49,15 @@ namespace Godot
             set { _size = value - _position; }
         }
 
+        /// <summary>
+        /// The volume of this <see cref="Aabb"/>.
+        /// See also <see cref="HasVolume"/>.
+        /// </summary>
+        public readonly real_t Volume
+        {
+            get { return _size.X * _size.Y * _size.Z; }
+        }
+
         /// <summary>
         /// Returns an <see cref="Aabb"/> with equivalent position and size, modified so that
         /// the most-negative corner is the origin and the size is positive.
@@ -311,15 +320,6 @@ namespace Godot
                 dir.Z > 0f ? -halfExtents.Z : halfExtents.Z);
         }
 
-        /// <summary>
-        /// Returns the volume of the <see cref="Aabb"/>.
-        /// </summary>
-        /// <returns>The volume.</returns>
-        public readonly real_t GetVolume()
-        {
-            return _size.X * _size.Y * _size.Z;
-        }
-
         /// <summary>
         /// Returns a copy of the <see cref="Aabb"/> grown a given amount of units towards all the sides.
         /// </summary>
@@ -383,7 +383,7 @@ namespace Godot
         /// Returns <see langword="true"/> if the <see cref="Aabb"/> has
         /// area, and <see langword="false"/> if the <see cref="Aabb"/>
         /// is linear, empty, or has a negative <see cref="Size"/>.
-        /// See also <see cref="GetVolume"/>.
+        /// See also <see cref="Volume"/>.
         /// </summary>
         /// <returns>
         /// A <see langword="bool"/> for whether or not the <see cref="Aabb"/> has volume.

+ 3 - 12
modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2.cs

@@ -51,11 +51,11 @@ namespace Godot
 
         /// <summary>
         /// The area of this <see cref="Rect2"/>.
+        /// See also <see cref="HasArea"/>.
         /// </summary>
-        /// <value>Equivalent to <see cref="GetArea()"/>.</value>
         public readonly real_t Area
         {
-            get { return GetArea(); }
+            get { return _size.X * _size.Y; }
         }
 
         /// <summary>
@@ -160,15 +160,6 @@ namespace Godot
             return expanded;
         }
 
-        /// <summary>
-        /// Returns the area of the <see cref="Rect2"/>.
-        /// </summary>
-        /// <returns>The area.</returns>
-        public readonly real_t GetArea()
-        {
-            return _size.X * _size.Y;
-        }
-
         /// <summary>
         /// Returns the center of the <see cref="Rect2"/>, which is equal
         /// to <see cref="Position"/> + (<see cref="Size"/> / 2).
@@ -247,7 +238,7 @@ namespace Godot
         /// Returns <see langword="true"/> if the <see cref="Rect2"/> has
         /// area, and <see langword="false"/> if the <see cref="Rect2"/>
         /// is linear, empty, or has a negative <see cref="Size"/>.
-        /// See also <see cref="GetArea"/>.
+        /// See also <see cref="Area"/>.
         /// </summary>
         /// <returns>
         /// A <see langword="bool"/> for whether or not the <see cref="Rect2"/> has area.

+ 3 - 12
modules/mono/glue/GodotSharp/GodotSharp/Core/Rect2I.cs

@@ -51,11 +51,11 @@ namespace Godot
 
         /// <summary>
         /// The area of this <see cref="Rect2I"/>.
+        /// See also <see cref="HasArea"/>.
         /// </summary>
-        /// <value>Equivalent to <see cref="GetArea()"/>.</value>
         public readonly int Area
         {
-            get { return GetArea(); }
+            get { return _size.X * _size.Y; }
         }
 
         /// <summary>
@@ -150,15 +150,6 @@ namespace Godot
             return expanded;
         }
 
-        /// <summary>
-        /// Returns the area of the <see cref="Rect2I"/>.
-        /// </summary>
-        /// <returns>The area.</returns>
-        public readonly int GetArea()
-        {
-            return _size.X * _size.Y;
-        }
-
         /// <summary>
         /// Returns the center of the <see cref="Rect2I"/>, which is equal
         /// to <see cref="Position"/> + (<see cref="Size"/> / 2).
@@ -239,7 +230,7 @@ namespace Godot
         /// Returns <see langword="true"/> if the <see cref="Rect2I"/> has
         /// area, and <see langword="false"/> if the <see cref="Rect2I"/>
         /// is linear, empty, or has a negative <see cref="Size"/>.
-        /// See also <see cref="GetArea"/>.
+        /// See also <see cref="Area"/>.
         /// </summary>
         /// <returns>
         /// A <see langword="bool"/> for whether or not the <see cref="Rect2I"/> has area.