Internally stores a unsigned long to be able to toggle 512 different regions. More...
Inherits IEquatable< NavMeshRegionMask >.
Public Member Functions | |
NavMeshRegionMask (ulong regionMask1, ulong regionMask2=0UL, ulong regionMask3=0UL, ulong regionMask4=0UL, ulong regionMask5=0UL, ulong regionMask6=0UL, ulong regionMask7=0UL, ulong regionMask8=0UL) | |
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... | |
readonly bool | IsRegionEnabled (int region) |
Check if a region is active. More... | |
readonly bool | IsSubset (in NavMeshRegionMask other) |
Check if the region mask is included inside the other. More... | |
readonly bool | IsSuperset (in NavMeshRegionMask other) |
Check is the region mask of other is included in ours. More... | |
readonly bool | Overlaps (in NavMeshRegionMask other) |
Returns true if the mask and other have at least one region in common. More... | |
void | Remove (int region) |
Remove a region from the mask. More... | |
void | Serialize (ByteStream stream, Boolean write, int blockCount=BLOCK_COUNT) |
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, in NavMeshRegionMask b) |
Combine two region masks. More... | |
static NavMeshRegionMask | Create (int region) |
Create a NavMeshRegionMask with one region enabled. More... | |
static NavMeshRegionMask | Create (int[] regionList) |
Create a mask using a list of region ids. More... | |
static NavMeshRegionMask | Create (System.Collections.Generic.List< int > regionList) |
Create a mask using a list of region ids. 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 | |
ulong | Mask => _regions[0] |
Access to underlying bit mask. More... | |
Static Public Attributes | |
static NavMeshRegionMask | Default => new NavMeshRegionMask(~0UL, ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, ~0UL, ~0UL) |
Default mask with all regions toggled on. More... | |
static NavMeshRegionMask | Empty => new NavMeshRegionMask(0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL) |
Mask that includes no area. More... | |
static NavMeshRegionMask | MainArea => new NavMeshRegionMask(1UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 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... | |
Properties | |
readonly bool | HasValidNoneMainRegion [get] |
Returns true if the mask includes a region other than the main area. More... | |
readonly bool | HasValidRegions [get] |
Returns true if the mask has at least one valid region set including the main area. More... | |
readonly bool | IsMainArea [get] |
Checks if the mask only contains the main area More... | |
Internally stores a unsigned long to be able to toggle 512 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 | |
regionMask3 | |
regionMask4 | |
regionMask5 | |
regionMask6 | |
regionMask7 | |
regionMask8 |
|
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. |
|
inlinestatic |
Create a mask using a list of region ids.
regionList | List of region ids/indices |
|
inlinestatic |
Create a mask using a list of region ids.
regionList | List of region ids/indices |
|
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 |
Returns true
if the mask and other have at least one region in common.
other | Other region mask |
true
if masks have one region in common
|
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. |
blockCount | Optionally customize block count. |
|
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.
ulong Quantum.NavMeshRegionMask.Mask => _regions[0] |
Access to underlying bit mask.
|
get |
Returns true
if the mask has at least one valid region set including the main area.
|
get |
Returns true
if the mask includes a region other than the main area.
|
get |
Checks if the mask only contains the main area