Implement Deconstruct
methods for C# vectors
See https://docs.microsoft.com/en-us/dotnet/csharp/fundamentals/functional/deconstruct#user-defined-types
This commit is contained in:
parent
b70a83a2b9
commit
20d72e462b
@ -81,6 +81,15 @@ namespace Godot
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper method for deconstruction into a tuple.
|
||||||
|
/// </summary>
|
||||||
|
public void Deconstruct(out real_t x, out real_t y)
|
||||||
|
{
|
||||||
|
x = this.x;
|
||||||
|
y = this.y;
|
||||||
|
}
|
||||||
|
|
||||||
internal void Normalize()
|
internal void Normalize()
|
||||||
{
|
{
|
||||||
real_t lengthsq = LengthSquared();
|
real_t lengthsq = LengthSquared();
|
||||||
|
@ -81,6 +81,15 @@ namespace Godot
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper method for deconstruction into a tuple.
|
||||||
|
/// </summary>
|
||||||
|
public void Deconstruct(out int x, out int y)
|
||||||
|
{
|
||||||
|
x = this.x;
|
||||||
|
y = this.y;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a new vector with all components in absolute values (i.e. positive).
|
/// Returns a new vector with all components in absolute values (i.e. positive).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -96,6 +96,16 @@ namespace Godot
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper method for deconstruction into a tuple.
|
||||||
|
/// </summary>
|
||||||
|
public void Deconstruct(out real_t x, out real_t y, out real_t z)
|
||||||
|
{
|
||||||
|
x = this.x;
|
||||||
|
y = this.y;
|
||||||
|
z = this.z;
|
||||||
|
}
|
||||||
|
|
||||||
internal void Normalize()
|
internal void Normalize()
|
||||||
{
|
{
|
||||||
real_t lengthsq = LengthSquared();
|
real_t lengthsq = LengthSquared();
|
||||||
|
@ -96,6 +96,16 @@ namespace Godot
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper method for deconstruction into a tuple.
|
||||||
|
/// </summary>
|
||||||
|
public void Deconstruct(out int x, out int y, out int z)
|
||||||
|
{
|
||||||
|
x = this.x;
|
||||||
|
y = this.y;
|
||||||
|
z = this.z;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a new vector with all components in absolute values (i.e. positive).
|
/// Returns a new vector with all components in absolute values (i.e. positive).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user