Struct Xz¶
Represents a 2D coordinate.
Namespace: VoxelTycoon
Constructors¶
Xz(int)¶
Creates a new Xz from an integer. X and Z members are set to the integer.
Declaration
Type | Name | Description |
---|---|---|
int | xz | Value given to X and Z |
Xz(int, int)¶
Creates a new Xz from two integers representing X and Z.
Declaration
Type | Name | Description |
---|---|---|
int | x | X coordinate |
int | z | Z coordinate |
Xz(Vector3)¶
Creates a new Xz from a 3D vector. Only the x and z coordinates are used.
Declaration
Type | Name | Description |
---|---|---|
Vector3 | vector3 | vector3.x is given to X and vector3.z to Z |
Members¶
X¶
X coordinate.
Declaration
Type | Description |
---|---|
int | X coordinate |
Z¶
Z coordinate.
Declaration
Type | Description |
---|---|
int | Z coordinate |
Properties¶
Forward¶
Xz forward instance, equivalent to Xz(0, 1).
Declaration
Type | Description |
---|---|
Xz | Xz(0, 1) |
Right¶
Xz right instance, equivalent to Xz(1, 0).
Declaration
Type | Description |
---|---|
Xz | Xz(1, 0) |
One¶
Xz one instance, equivalent to Xz(1, 1).
Declaration
Type | Description |
---|---|
Xz | Xz(1, 1) |
Zero¶
Xz zero instance, equivalent to Xz(0, 0).
Declaration
Type | Description |
---|---|
Xz | Xz(0, 0) |
Volume¶
Xz's volume, obtained by multiplying X and Z members.
Declaration
Type | Description |
---|---|
int | Equals X*Z |
this[int]¶
Gets or sets the X and Z coordinates depending on the given value and index.
Declaration
Parameters
Type | Name | Description |
---|---|---|
int | i | X corresponds to i=0 and Z to i=1 |
Returns
Type | Description |
---|---|
int | X or Z depending on i's value |
Methods¶
Abs()¶
Gets the absolute version of the Xz, equivalent to Xz(abs(x), abs(z)).
Declaration
Type | Description |
---|---|
Xz | Xz(abs(x), abs(z))z |
Deconstruct(int, int)¶
Deconstructs the Xz. Returns x and z values.
Declaration
Type | Name | Description |
---|---|---|
out int | x | X coordinate |
out int | z | Z coordinate |
Distance(Xz, Xz)¶
Returns the distance between two Xz.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xz | xz1 | First Xz |
Xz | xz2 | Second Xz |
Returns
Type | Description |
---|---|
float | Distance between xz1 and xz2 |
DistanceManhattan(Xz, Xz)¶
Returns the manhattan (taxicab) distance between two Xz.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xz | xz1 | First Xz |
Xz | xz2 | Second Xz |
Returns
Type | Description |
---|---|
float | Manhattan distance between xz1 and xz2 |
Equals(object)¶
Tests if the Xz is equals to the object. They are equal if they are both Xz and their coordinates are equal.
Declaration
Parameters
Type | Name | Description |
---|---|---|
object | obj | Object to compare the Xz with |
Returns
Type | Description |
---|---|
bool | Returns true if obj is equals to the Xz |
Equals(Xz)¶
Tests if two Xz are equals. Two Xzs are equal if their X and Z coordinates are equal.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xz | other | Xz to compare with |
Returns
Type | Description |
---|---|
bool | Returns true if the two Xz are equal |
GetHashCode()¶
Returns the hash code of the Xz.
Declaration
Returns
Type | Description |
---|---|
int | Value of the hash code |
Max()¶
Returns the max of the coordinates of the Xz.
Declaration
Returns
Type | Description |
---|---|
int | Max between X and Z |
Min()¶
Returns the min of the coordinates of the Xz.
Declaration
Returns
Type | Description |
---|---|
int | Min between X and Z |
Max(Xz, Xz)¶
Returns a new Xz with the maximum of the coordinates between the two Xzs.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xz | xz1 | First Xz |
Xz | xz2 | Second Xz |
Returns
Type | Description |
---|---|
Xz | Max Xz between xz1 and xz2 |
Min(Xz, Xz)¶
Returns a new Xz with the minimum of the coordinates between the two Xzs.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xz | xz1 | First Xz |
Xz | xz2 | Second Xz |
Returns
Type | Description |
---|---|
Xz | Min Xz between xz1 and xz2 |
Rotate(BuildingRotation, Xz)¶
Rotate and translates a Xz.
Declaration
Parameters
Type | Name | Description |
---|---|---|
BuildingRotation | rotation | Rotation to apply to the Xz |
Xz | translation | Optional translation to apply to the Xz |
Returns
Type | Description |
---|---|
Xz | Rotated and translated version of the Xz |
SquaredDistance(Xz, Xz)¶
Returns the squared distance between two Xz.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xz | xz1 | First Xz |
Xz | xz2 | Second Xz |
Returns
Type | Description |
---|---|
int | Squared distance between xz1 and xz2 |
ToString()¶
Returns a string representing the Xz.
Declaration
Returns
Type | Description |
---|---|
string | String representing the Xz |
Operators¶
+(Xz, Xz)¶
Returns the sum of two Xz which is calculated by the sum of each coordinates.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xz | xz | First Xz |
Xz | xz2 | Second Xz |
Returns
Type | Description |
---|---|
Xz | Sum of xz and xz2 |
-(Xz, Xz)¶
Returns the substraction of two Xz which is calculated by the substraction of each coordinates.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xz | xz | First Xz |
Xz | xz2 | Second Xz |
Returns
Type | Description |
---|---|
Xz | Substraction of xz and xz2 |
*(Xz, Xz)¶
Returns the multiplication of two Xz which is calculated by the multiplication of each coordinates.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xz | xz1 | First Xz |
Xz | xz2 | Second Xz |
Returns
Type | Description |
---|---|
Xz | Multiplication of xz1 and xz2 |
/(Xz, Xz)¶
Returns the division of two Xz which is calculated by the division of each coordinates.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xz | xz1 | First Xz |
Xz | xz2 | Second Xz |
Returns
Type | Description |
---|---|
Xz | Division of xz1 and xz2 |
*(Xz, int)¶
Returns the multiplication between an integer and a Xz. The result is calculated by multiplying each Xz coordinate by the integer.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xz | xz | Xz to multiply |
int | a | Integer to multiply |
Returns
Type | Description |
---|---|
Xz | Multiplication of xz by a |
/(Xz, int)¶
Returns the division of a Xz by an integer. The result is calculated by dividing each Xz coordinate by the integer.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xz | xz | Divendent |
int | a | Divider |
Returns
Type | Description |
---|---|
Xz | Division of xz by a |
/(Xz, float)¶
Returns the division of Xz by a float in a Vector3. The result is calculated by dividing each Xz coordinate by the float. The Y coordinate is set to 0.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xz | xz | Divendent |
float | a | Divider |
Returns
Type | Description |
---|---|
Vector3 | Contains the division of xz by a |
-(Xz)¶
Returns the opposite of the Xz which is calculated by getting the opposite of each coordinate.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xz | xz | Xz provided |
Returns
Type | Description |
---|---|
Xz | Opposite of xz |
Vector2(Xz)¶
Returns a Vector2 from a Xz.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xz | xz | Xz provided |
Returns
Type | Description |
---|---|
Vector2 | Contains xz's coordinates in its X and Y coordinates |
Vector3(Xz)¶
Returns a Vector3 from a Xz. The Y coordinate is set to 0.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xz | xz | Xz provided |
Returns
Type | Description |
---|---|
Vector3 | Contains xz's coordinates in its X and Z coordinates |
Xyz(Xz)¶
Returns a Xyz with a Xz's coordinates. The Y coordinate is set to 0.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xz | xz | Xz provided |
Returns
Type | Description |
---|---|
Xyz | Contains xz's coordinates in its X and Z coordinates |
Xz(Xyz)¶
Returns a Xz with a Xyz's coordinates. The Y coordinate is not kept.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xyz | xyz | Xyz provided |
Returns
Type | Description |
---|---|
Xz | Contains xyz's X and Z coordinates |
==(Xz, Xz)¶
Returns true if the two provided Xzs are equal.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xz | a | First Xz |
Xz | b | Second Xz |
Returns
Type | Description |
---|---|
bool | True if a and b are equal |
!=(Xz, Xz)¶
Returns false if the two provided Xzs are equal.
Declaration
Parameters
Type | Name | Description |
---|---|---|
Xz | a | First Xz |
Xz | b | Second Xz |
Returns
Type | Description |
---|---|
bool | False if a and b are equal |