Custom rule for a grid graph.
More...
◆ Pass
Where in the scanning process a rule will be executed.
Enumerator |
---|
BeforeCollision | Before the collision testing phase but after height testing.
This is very early. Most data is not valid by this point.
You can use this if you want to modify the node positions and still have it picked up by the collision testing code.
|
BeforeConnections | Before connections are calculated.
At this point height testing, collision testing has been done (if they are enabled).
This is the most common pass to use. If you are modifying walkability here then connections and erosion will be calculated properly.
|
AfterConnections | After connections are calculated.
If you are modifying connections directly you should that in this pass.
- Note
- If erosion is used then this pass will be executed twice. One time before erosion and one time after erosion when the connections are calculated again.
|
PostProcess | After everything else.
This pass is executed after everything else is done. You should not modify walkability in this pass because then the node connections will not be up to date.
|
◆ DisposeUnmanagedData()
virtual void DisposeUnmanagedData |
( |
| ) |
|
|
virtual |
Called when the rule is removed or the graph is destroyed.
Use this to e.g. clean up any NativeArrays that the rule uses.
- Note
- The rule should remain valid after this method has been called. However the Register method is guaranteed to be called before the rule is executed again.
Reimplemented in RuleTexture, RuleElevationPenalty, and RuleAnglePenalty.
◆ FilterNodeConnections< T >()
static void FilterNodeConnections< T > |
( |
IntRect |
bounds, |
|
|
NativeArray< int > |
nodeConnections, |
|
|
ref T |
filter |
|
) |
| |
|
static |
- Type Constraints
-
T | : | struct | |
T | : | IConnectionFilter | |
◆ ForEachNode< T >()
static void ForEachNode< T > |
( |
IntRect |
bounds, |
|
|
ref T |
callback |
|
) |
| |
|
static |
- Type Constraints
-
T | : | struct | |
T | : | INodeModifier | |
◆ Register()
◆ SetDirty()
virtual void SetDirty |
( |
| ) |
|
|
virtual |
Call if you have changed any setting of the rule.
This will ensure that any cached data the rule uses is rebuilt. If you do not do this then any settings changes may not affect the graph when it is rescanned or updated.
◆ dirty
◆ enabled
Only enabled rules are executed.
◆ Hash
virtual int Hash => dirty |
Hash of the settings for this rule.
The Register method will be called again whenever the hash changes. If the hash does not change it is assumed that the Register method does not need to be called again.
The documentation for this class was generated from the following file:
- /Users/arong/Unity/a-pathfinding-project/Assets/AstarPathfindingProject/Generators/GridGraph/GridGraphRules.cs