public struct InRangeZoneGrouping : IEquatable<InRangeZoneGrouping>, IComparable<InRangeZoneGrouping>
Represents an In Range Zone Grouping. Contains the index of the Zone/World Grouping that the ZoneGrouping belongs to, as well as the repeated World indicies of the Zone Grouping.
Name | Type | Default Value | Description |
---|---|---|---|
RepeatedWorldIndices | 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.
|
|
WorldGroupingIndex | readonly int |
The index of the World Grouping that the Zone Grouping is associated with. |
|
ZoneIndex | int |
The index of the Zone that the Zone Grouping is associated with. |
public InRangeZoneGrouping(Cell repeatedWorldIndices, int zoneIndex, int groupingIndex)
Initializes a new instance of the InRangeZoneGrouping 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 that the Zone Grouping is associated with. |
groupingIndex | int |
The index of the World Grouping that the Zone Grouping is associated with. |
public static bool operator !=(InRangeZoneGrouping left, InRangeZoneGrouping right)
!= operater implementation that allows you check if two InRangeZoneGroupings are not
equal
The two InRangeZoneGroupings will not be equal if the ZoneIndex, WorldGroupingIndex,
rows, columns, or
layers do not match each other from one InRangeZoneGrouping to
the other (row != row, etc.)
Name | Type | Description |
---|---|---|
left | InRangeZoneGrouping |
The first InRangeZoneGrouping. |
right | InRangeZoneGrouping |
The second InRangeZoneGrouping. |
bool
Returns true if the InRangeZoneGroupings are not equal, false if they are equal.
public static bool operator <(InRangeZoneGrouping left, InRangeZoneGrouping right)
< operater implementation that allows you check if the left InRangeZoneGrouping is less than the right InRangeZoneGrouping.
Name | Type | Description |
---|---|---|
left | InRangeZoneGrouping |
The left InRangeZoneGrouping. |
right | InRangeZoneGrouping |
The right InRangeZoneGrouping. |
bool
Please refer to the CompareTo method documentation to understand
how InRangeZoneGrouping comparison works.
public static bool operator <=(InRangeZoneGrouping left, InRangeZoneGrouping right)
<= operater implementation that allows you check if the left InRangeZoneGrouping is less than or equal to the right InRangeZoneGrouping.
Name | Type | Description |
---|---|---|
left | InRangeZoneGrouping |
The left InRangeZoneGrouping. |
right | InRangeZoneGrouping |
The right InRangeZoneGrouping. |
bool
Please refer to the CompareTo method documentation to understand
how InRangeZoneGrouping comparison works.
public static bool operator ==(InRangeZoneGrouping left, InRangeZoneGrouping right)
!= operater implementation that allows you check if two InRangeZoneGroupings are equal
The two InRangeZoneGroupings will be equal if the ZoneIndex, WorldGroupingIndex, rows,
columns, or layers all match each other from one InRangeZoneGrouping to
the other (row == row, etc.)
Name | Type | Description |
---|---|---|
left | InRangeZoneGrouping |
The first InRangeZoneGrouping. |
right | InRangeZoneGrouping |
The second InRangeZoneGrouping. |
bool
Returns true if the InRangeZoneGroupings are equal, false if they are not equal.
public static bool operator >(InRangeZoneGrouping left, InRangeZoneGrouping right)
> operater implementation that allows you check if the left InRangeZoneGrouping is greater than the right InRangeZoneGrouping.
Name | Type | Description |
---|---|---|
left | InRangeZoneGrouping |
The left InRangeZoneGrouping. |
right | InRangeZoneGrouping |
The right InRangeZoneGrouping. |
bool
Please refer to the CompareTo method documentation to understand
how InRangeZoneGrouping comparison works.
public static bool operator >=(InRangeZoneGrouping left, InRangeZoneGrouping right)
>= operater implementation that allows you check if the left InRangeZoneGrouping is greater than or equal to the right InRangeZoneGrouping.
Name | Type | Description |
---|---|---|
left | InRangeZoneGrouping |
The left InRangeZoneGrouping. |
right | InRangeZoneGrouping |
The right InRangeZoneGrouping. |
bool
Please refer to the CompareTo method documentation to understand
how InRangeZoneGrouping comparison works.
public int CompareTo(InRangeZoneGrouping other)
Compares the input InRangeZoneGrouping against this InRangeZoneGrouping to determine whether this InRangeZoneGrouping procedes, follows, or is at the same position of the input InRangeZoneGrouping. This can be used to order a collection of InRangeZoneGroupings in the same manner as they would appear in the scene (if they were associated with World InRangeZoneGroupings, 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 InRangeZoneGrouping to compare this InRangeZoneGrouping against. |
int
-1 if this InRangeZoneGrouping precedes (is less than) the input "other" InRangeZoneGrouping,
+1 if this InRangeZoneGrouping follows (is greater than)
the input "other" InRangeZoneGrouping, and 0 if the InRangeZoneGroupings 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(InRangeZoneGrouping other)
Implementation of IEquatable<InRangeZoneGrouping>.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
InRangeZoneGrouping EqualityComparer
that ignores the layer
Name | Type | Description |
---|---|---|
other | object |
The other InRangeZoneGrouping to compare this InRangeZoneGrouping against. |
bool
false if the row, column, and/or layer value on
the other InRangeZoneGrouping is not equal to this InRangeZoneGrouping'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 InRangeZoneGrouping to be boxed.
Name | Type | Description |
---|---|---|
obj | object |
The object to check this InRangeZoneGrouping against. |
bool
false if the object is not a InRangeZoneGrouping or it is but the ZoneIndex, WorldGroupingIndex,
row, column, and/or layer value on
the obj is not equal to this InRangeZoneGrouping's ZoneIndex, WorldGroupingIndex,
row, column, and/or layer value.
public override int GetHashCode()
Returns a hash code for this InRangeZoneGrouping. Uses all six indexes (WorldGroupingIndex, Row, Column and Layer) to compute it, so the InRangeZoneGrouping is treated as a 3D InRangeZoneGrouping.
int
The hash code of the InRangeZoneGrouping.