public struct InRangeZone : IEquatable<InRangeZone>, IComparable<InRangeZone>
Represents an In Range Zone. Contains the index of the Zone, as well as the repeated World indicies of the Zone.
Name | Type | Default Value | Description |
---|---|---|---|
AllZoneGroupingsGauranteedToBeInRange | bool |
The zone's bounding volume encompasses all Zone Groupings that a zone contains. The
min position of this bounding volume will always be
equal to the min position of each Zone Grouping, as all Zone Groupings have the same
min position. However, each Zone Grouping can have a variable
size, which means they can end at different positions in the game world. The Zone's
bounding volme max position is thus equal to the position of the
largest Zone Grouping, however this means the max position of the bounding volume
does not accurately reflect the max position of all Zone Groupings.
|
|
DistanceOfZoneFromPosition | double |
The distance between the Zoen and the position it was tested against. |
|
WorldRepetitionIndices | readonly Cell |
Index of the Zone Grouping in relation to the Repeated World. This is needed when
working with Endless/Repeating Worlds. A value of 0 for an index
indicates that that index is within the confines of the original (non repeated) World.
A value of 1 would indicate that index falls into the
next greatest repetition of the World on that indices axis, 2 would be the next one
after that, and so on. Negative values are also possible.
|
|
ZoneIndex | int |
The index of the Zone. |
|
ZonePosition | Vector3Double |
The position of the Zone in the scene, defined as the min point of the zone. |
public InRangeZone(Cell repeatedWorldIndices, int zoneIndex, int groupingIndex)
Initializes a new instance of the InRangeZone structure.
Name | Type | Description |
---|---|---|
repeatedWorldIndices | Cell |
Tells you which repeated World this Zone Grouping is a part of on each axis (if using and endless/repeating World). |
zoneIndex | int |
The index of the Zone. |
allZoneGroupingsGauranteedToBeInRange | bool |
The zone's bounding volume encompasses all Zone Groupings that a zone contains. The
min position of this bounding volume will always be
equal to the min position of each Zone Grouping, as all Zone Groupings have the same
min position. However, each Zone Grouping can have a variable
size, which means they can end at different positions in the game world. The Zone's
bounding volme max position is thus equal to the position of the
largest Zone Grouping, however this means the max position of the bounding volume
does not accurately reflect the max position of all Zone Groupings.
|
distanceOfZoneFromPosition | double |
The distance between the Zoen and the position it was tested against. |
zonePosition | Vector3Double |
The position of the Zone in the scene, defined as the min point of the zone. |
public static bool operator !=(InRangeZone left, InRangeZone right)
!= operater implementation that allows you check if two InRangeZones are not equal
The two InRangeZones will not be equal if the ZoneIndex, WorldGroupingIndex, rows,
columns, or
layers do not match each other from one InRangeZone to
the other (row != row, etc.)
Name | Type | Description |
---|---|---|
left | InRangeZone |
The first InRangeZone. |
right | InRangeZone |
The second InRangeZone. |
bool
Returns true if the InRangeZones are not equal, false if they are equal.
public static bool operator <(InRangeZone left, InRangeZone right)
< operater implementation that allows you check if the left InRangeZone is less than the right InRangeZone.
Name | Type | Description |
---|---|---|
left | InRangeZone |
The left InRangeZone. |
right | InRangeZone |
The right InRangeZone. |
bool
Please refer to the CompareTo method documentation to understand
how InRangeZone comparison works.
public static bool operator <=(InRangeZone left, InRangeZone right)
<= operater implementation that allows you check if the left InRangeZone is less than or equal to the right InRangeZone.
Name | Type | Description |
---|---|---|
left | InRangeZone |
The left InRangeZone. |
right | InRangeZone |
The right InRangeZone. |
bool
Please refer to the CompareTo method documentation to understand
how InRangeZone comparison works.
public static bool operator ==(InRangeZone left, InRangeZone right)
!= operater implementation that allows you check if two InRangeZones are equal
The two InRangeZones will be equal if the ZoneIndex, WorldGroupingIndex, rows, columns,
or layers all match each other from one InRangeZone to
the other (row == row, etc.)
Name | Type | Description |
---|---|---|
left | InRangeZone |
The first InRangeZone. |
right | InRangeZone |
The second InRangeZone. |
bool
Returns true if the InRangeZones are equal, false if they are not equal.
public static bool operator >(InRangeZone left, InRangeZone right)
> operater implementation that allows you check if the left InRangeZone is greater than the right InRangeZone.
Name | Type | Description |
---|---|---|
left | InRangeZone |
The left InRangeZone. |
right | InRangeZone |
The right InRangeZone. |
bool
Please refer to the CompareTo method documentation to understand
how InRangeZone comparison works.
public static bool operator >=(InRangeZone left, InRangeZone right)
>= operater implementation that allows you check if the left InRangeZone is greater than or equal to the right InRangeZone.
Name | Type | Description |
---|---|---|
left | InRangeZone |
The left InRangeZone. |
right | InRangeZone |
The right InRangeZone. |
bool
Please refer to the CompareTo method documentation to understand
how InRangeZone comparison works.
public int CompareTo(InRangeZone other)
Compares the input InRangeZone against this InRangeZone to determine whether this InRangeZone procedes, follows, or is at the same position of the input InRangeZone. This can be used to order a collection of InRangeZones in the same manner as they would appear in the scene (if they were associated with World InRangeZones, that is). The method utilizes the row, column, and layer values. If you know the layer value is not used (such as in a 2D world), you may choose to use a different method rather than this one.
Name | Type | Description |
---|---|---|
other | object |
The other InRangeZone to compare this InRangeZone against. |
int
-1 if this InRangeZone precedes (is less than) the input "other" InRangeZone, +1 if
this InRangeZone follows (is greater than)
the input "other" InRangeZone, and 0 if the InRangeZones are at the same position
(are equal).
The following logic is used to determine the order. First, the ZoneIndex of the two
cell's is compared. If this cell's
ZoneIndex is less than the input cell's ZoneIndex, -1 is returned. If it is greater
than the input cell's
ZoneIndex, +1 is returned. If they are equal, the WorldGroupingIndex is compared in
the same way. Then the Cell Layer,
Cell Row, and finally Cell Column. 0 is returned if all values are the same.
An important thing to note is lower World Groupings (which are actually probably more
important) will be before higher World Groupings.
As such, they are considered less than the higher World Grouping cells.
public bool Equals(InRangeZone other)
Implementation of IEquatable<InRangeZone>.Equals method. Use this, as it does not
box input struct.
This method compares the ZoneIndex, WorldGroupingIndex, row, column, and layer. In
some instances where you know the layer does not
matter (on 2D worlds for instance), it may be slightly more performant to use a custom
InRangeZone EqualityComparer
that ignores the layer
Name | Type | Description |
---|---|---|
other | object |
The other InRangeZone to compare this InRangeZone against. |
bool
false if the row, column, and/or layer value on
the other InRangeZone is not equal to this InRangeZone's LOD, row, column, and/or
layer value.
public override bool Equals(object obj)
Override of Equals method. You shouldn't need to use this, and you should not use it since it will cause the input InRangeZone to be boxed.
Name | Type | Description |
---|---|---|
obj | object |
The object to check this InRangeZone against. |
bool
false if the object is not a InRangeZone or it is but the ZoneIndex, WorldGroupingIndex,
row, column, and/or layer value on
the obj is not equal to this InRangeZone's ZoneIndex, WorldGroupingIndex, row, column,
and/or layer value.
public override int GetHashCode()
Returns a hash code for this InRangeZone. Uses all six indexes (WorldGroupingIndex, Row, Column and Layer) to compute it, so the InRangeZone is treated as a 3D InRangeZone.
int
The hash code of the InRangeZone.