Internally stores a unsigned long to be able to toggle 128 different regions. More...
Inherits IEquatable< NavMeshRegionMask >.
Public Member Functions | |
NavMeshRegionMask (ulong regionMask1, ulong regionMask2) | |
Constructor with all flag masks. This method could change in the future if the max regions count is increased again. More... | |
NavMeshRegionMask (ulong regions) | |
Constructor. More... | |
void | Add (int region) |
Add a region id to the mask. More... | |
void | Clear () |
This sets all regions to active. More... | |
bool | Equals (NavMeshRegionMask other) |
Equality check. More... | |
override bool | Equals (object obj) |
Equality check. More... | |
override int | GetHashCode () |
Get hash code override. More... | |
bool | IsRegionEnabled (int region) |
Check if a region is active. More... | |
bool | IsSubset (NavMeshRegionMask other) |
Check if the region mask is included inside the other. More... | |
bool | IsSuperset (NavMeshRegionMask other) |
Check is the region mask of other is included in ours. More... | |
void | Remove (int region) |
Remove a region from the mask. More... | |
void | Serialize (ByteStream stream, Boolean write) |
Serialize the mask into a byte stream, used by asset serialization and deserialization. More... | |
void | ToggleRegion (int region, bool enabled) |
Toggle a region by id (or index). More... | |
override string | ToString () |
ToString override. More... | |
Static Public Member Functions | |
static NavMeshRegionMask | Combine (NavMeshRegionMask a, NavMeshRegionMask b) |
Combine two region masks. More... | |
static NavMeshRegionMask | Create (int region) |
Create a NavMeshRegionMask with one region enabled. More... | |
static void | Print (void *ptr, FramePrinter printer) |
Callback to print this component data. More... | |
static void | Serialize (void *ptr, FrameSerializer serializer) |
Callback to serialize this component into a snapshot of the game state. More... | |
Public Attributes | |
bool | HasValidNoneMainRegion => _regions[0] > 1UL || _regions[1] != 0UL |
Returns true if the mask includes a region other than the main area. More... | |
bool | HasValidRegions => _regions[0] >= 1UL || _regions[1] != 0UL |
Returns true if the mask has at least one valid region set including the main area. More... | |
bool | IsMainArea => _regions[0] == 1UL && _regions[1] == 0UL |
Checks if the mask only contains the main area More... | |
ulong | Mask => _regions[0] |
Access to underlying bit mask. More... | |
Static Public Attributes | |
static NavMeshRegionMask | Default => new NavMeshRegionMask(~0UL, ~0UL) |
Default mask with all regions toggled on. More... | |
static NavMeshRegionMask | Empty => new NavMeshRegionMask(0UL, 0UL) |
Mask that includes no area. More... | |
static NavMeshRegionMask | MainArea => new NavMeshRegionMask(1UL, 0UL) |
Mask that includes only the main area. More... | |
const int | MAX_REGIONS = BLOCK_COUNT * BITS_PER_BLOCK |
The maximum number of regions. More... | |
const int | SIZE = BLOCK_COUNT * sizeof(ulong) |
The size on the struct. More... | |
Internally stores a unsigned long to be able to toggle 128 different regions.
When instantiating a NavMeshRegionMask, all regions are toggled off.
Use Default to create a mask with all regions toggled on.
|
inline |
Constructor.
regions | Raw region mask |
|
inline |
Constructor with all flag masks. This method could change in the future if the max regions count is increased again.
regionMask1 | |
regionMask2 |
|
inlinestatic |
Combine two region masks.
a | A |
b | B |
|
inlinestatic |
Callback to serialize this component into a snapshot of the game state.
ptr | The component pointer |
serializer | The serializer |
|
inlinestatic |
Callback to print this component data.
ptr | The component pointer |
printer | The printer |
|
inlinestatic |
Create a NavMeshRegionMask with one region enabled.
region | Region id to enabled. |
|
inline |
Toggle a region by id (or index).
region | Region id (defined by the region list inside the Map) |
enabled | Toggle region on or off |
|
inline |
Add a region id to the mask.
region | Region index |
|
inline |
Remove a region from the mask.
region | Region index |
|
inline |
Check if a region is active.
region | Region id (or index) |
true
if the region is active.
|
inline |
Check if the region mask is included inside the other.
other | Other mask, usually the one from Frame |
true
if all regions are included in other
|
inline |
Check is the region mask of other is included in ours.
other | Other region mask |
true
if all regions inside the other mask are also active in ours
|
inline |
This sets all regions to active.
|
inline |
Equality check.
other | Other mask |
true
, if both masks are equal.
|
inline |
Equality check.
obj | Other object |
true
, is both masks are equal.
|
inline |
Get hash code override.
|
inline |
ToString override.
|
inline |
Serialize the mask into a byte stream, used by asset serialization and deserialization.
stream | Stream object. |
write | Write or read. |
|
static |
The size on the struct.
|
static |
The maximum number of regions.
|
static |
Default mask with all regions toggled on.
|
static |
Mask that includes only the main area.
|
static |
Mask that includes no area.
bool Quantum.NavMeshRegionMask.HasValidRegions => _regions[0] >= 1UL || _regions[1] != 0UL |
Returns true
if the mask has at least one valid region set including the main area.
bool Quantum.NavMeshRegionMask.HasValidNoneMainRegion => _regions[0] > 1UL || _regions[1] != 0UL |
Returns true
if the mask includes a region other than the main area.
bool Quantum.NavMeshRegionMask.IsMainArea => _regions[0] == 1UL && _regions[1] == 0UL |
Checks if the mask only contains the main area
ulong Quantum.NavMeshRegionMask.Mask => _regions[0] |
Access to underlying bit mask.