-
Notifications
You must be signed in to change notification settings - Fork 0
Vector2Int Extension
Andrzej Kebab edited this page Feb 2, 2024
·
1 revision
Deconstructs a Vector2Int instance into its individual components.
Vector2Int vector = // initialize your Vector2Int
int x, y;
vector.Deconstruct(out x, out y);Parameters:
-
vector: The Vector2Int instance.
Outputs:
-
x: The x component of the Vector2Int. -
y: The y component of the Vector2Int.
Creates a new Vector2Int instance with the specified components, or the original components if not specified.
Vector2Int originalVector = // initialize your Vector2Int
int? x = // optional
int? y = // optional
Vector2Int newVector = originalVector.With(x, y);Parameters:
-
originalVector: The original Vector2Int instance. -
x: The x component of the new Vector2Int. If null, the x component of the original Vector2Int is used. -
y: The y component of the new Vector2Int. If null, the y component of the original Vector2Int is used.
Returns:
-
newVector: A new Vector2Int instance with the specified components.
Flips a Vector2Int in both the x and y directions.
Vector2Int vector = // initialize your Vector2Int
Vector2Int flippedVector = vector.Flip();Parameters:
-
vector: The Vector2Int instance.
Returns:
-
flippedVector: The flipped Vector2Int.
Flips a Vector2Int in the x direction.
Vector2Int vector = // initialize your Vector2Int
Vector2Int flippedVector = vector.FlipX();Parameters:
-
vector: The Vector2Int instance.
Returns:
-
flippedVector: The flipped Vector2Int.
Flips a Vector2Int in the y direction.
Vector2Int vector = // initialize your Vector2Int
Vector2Int flippedVector = vector.FlipY();Parameters:
-
vector: The Vector2Int instance.
Returns:
-
flippedVector: The flipped Vector2Int.
Clamps the components of a Vector2Int between specified minimum and maximum values.
Vector2Int vector = // initialize your Vector2Int
int min = // initialize the minimum value
int max = // initialize the maximum value
Vector2Int clampedVector = vector.Clamp(min, max);Parameters:
-
vector: The Vector2Int instance. -
min: The minimum value to clamp the components to. -
max: The maximum value to clamp the components to.
Returns:
-
clampedVector: The clamped Vector2Int.
Clamps the components of a Vector2Int between specified minimum and maximum vectors.
Vector2Int vector = // initialize your Vector2Int
Vector2Int min = // initialize the minimum vector
Vector2Int max = // initialize the maximum vector
Vector2Int clampedVector = vector.Clamp(min, max);Parameters:
-
vector: The Vector2Int instance. -
min: The minimum vector to clamp the components to. -
max: The maximum vector to clamp the components to.
Returns:
-
clampedVector: The clamped Vector2Int.