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