A* Pathfinding Project  4.3.6
The A* Pathfinding Project for Unity 3D
RuleTexture Class Reference

Modifies nodes based on the contents of a texture. More...

Detailed Description

Modifies nodes based on the contents of a texture.

This can be used to "paint" penalties or walkability using an external program such as Photoshop.

See also
Grid Graph Rules

Classes

struct  JobTexturePenalty
 
struct  JobTexturePosition
 

Public Types

enum  ChannelUse {
  None, Penalty, Position, WalkablePenalty,
  Walkable
}
 
enum  ScalingMode { FixedScale, StretchToFitGraph }
 
- Public Types inherited from GridGraphRule
enum  Pass { BeforeCollision, BeforeConnections, AfterConnections, PostProcess }
 Where in the scanning process a rule will be executed. More...
 

Public Member Functions

override void DisposeUnmanagedData ()
 Called when the rule is removed or the graph is destroyed. More...
 
override void Register (GridGraphRules rules)
 Does preprocessing and adds callbacks to the #GridGraphRules object. More...
 
- Public Member Functions inherited from GridGraphRule
virtual void SetDirty ()
 Call if you have changed any setting of the rule. More...
 

Public Attributes

ChannelUse [] channels = new ChannelUse[4]
 
float [] channelScales = { 1000, 1000, 1000, 1000 }
 
float nodesPerPixel = 1
 
ScalingMode scalingMode = ScalingMode.StretchToFitGraph
 
Texture2D texture
 
- Public Attributes inherited from GridGraphRule
bool enabled = true
 Only enabled rules are executed. More...
 
virtual int Hash => dirty
 Hash of the settings for this rule. More...
 

Private Attributes

NativeArray< int > colors
 

Additional Inherited Members

- Static Public Member Functions inherited from GridGraphRule
static void FilterNodeConnections< T > (IntRect bounds, NativeArray< int > nodeConnections, ref T filter)
 
static void ForEachNode< T > (IntRect bounds, ref T callback)
 

Member Enumeration Documentation

◆ ChannelUse

enum ChannelUse
strong
Enumerator
None 
Penalty 

Penalty goes from 0 to channelScale depending on the channel value.

Position 

Node Y coordinate goes from 0 to channelScale depending on the channel value.

WalkablePenalty 

If channel value is zero the node is made unwalkable, penalty goes from 0 to channelScale depending on the channel value.

Walkable 

If channel value is zero the node is made unwalkable.

◆ ScalingMode

enum ScalingMode
strong
Enumerator
FixedScale 
StretchToFitGraph 

Member Function Documentation

◆ DisposeUnmanagedData()

override 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 from GridGraphRule.

◆ Register()

override void Register ( GridGraphRules  rules)
virtual

Does preprocessing and adds callbacks to the #GridGraphRules object.

Reimplemented from GridGraphRule.

Member Data Documentation

◆ channels

ChannelUse [] channels = new ChannelUse[4]

◆ channelScales

float [] channelScales = { 1000, 1000, 1000, 1000 }

◆ colors

NativeArray<int> colors
private

◆ nodesPerPixel

float nodesPerPixel = 1

◆ scalingMode

◆ texture

Texture2D texture

The documentation for this class was generated from the following file: