A* Pathfinding Project  3.8.10
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
GraphModifier Class Reference

GraphModifier is used for modifying graphs or processing graph data based on events. More...

Detailed Description

GraphModifier is used for modifying graphs or processing graph data based on events.

This class is a simple container for a number of events.

Warning
Some events will be called both in play mode and in editor mode (at least the scan events). So make sure your code handles both cases well. You may choose to ignore editor events.
See Also
Application.IsPlaying

Public Types

enum  EventType {
  PostScan = 1 << 0, PreScan = 1 << 1, LatePostScan = 1 << 2, PreUpdate = 1 << 3,
  PostUpdate = 1 << 4, PostCacheLoad = 1 << 5
}
 GraphModifier event type. More...
 

Public Member Functions

virtual void OnGraphsPostUpdate ()
 Called after graphs have been updated using GraphUpdateObjects.
 
virtual void OnGraphsPreUpdate ()
 Called before graphs are updated using GraphUpdateObjects.
 
virtual void OnLatePostScan ()
 Called at the end of the scanning procedure.
 
virtual void OnPostCacheLoad ()
 Called after cached graphs have been loaded.
 
virtual void OnPostScan ()
 Called right after all graphs have been scanned.
 
virtual void OnPreScan ()
 Called right before graphs are going to be scanned.
 

Static Public Member Functions

static void FindAllModifiers ()
 
static void TriggerEvent (GraphModifier.EventType type)
 Triggers an event for all active graph modifiers.
 

Protected Member Functions

virtual void Awake ()
 
virtual void OnDestroy ()
 
virtual void OnDisable ()
 Removes this modifier from list of active modifiers.
 
virtual void OnEnable ()
 Adds this modifier to list of active modifiers.
 

Static Protected Member Functions

static List< T > GetModifiersOfType< T > ()
 

Protected Attributes

ulong uniqueID
 Unique persistent ID for this component, used for serialization.
 

Static Protected Attributes

static Dictionary< ulong,
GraphModifier
usedIDs = new Dictionary<ulong, GraphModifier>()
 Maps persistent IDs to the component that uses it.
 

Private Member Functions

void AddToLinkedList ()
 
void ConfigureUniqueID ()
 
void RemoveFromLinkedList ()
 
void Reset ()
 

Private Attributes

GraphModifier next
 
GraphModifier prev
 

Static Private Attributes

static GraphModifier root
 All active graph modifiers.
 

Member Enumeration Documentation

enum EventType

GraphModifier event type.

Enumerator:
PostScan 
PreScan 
LatePostScan 
PreUpdate 
PostUpdate 
PostCacheLoad 

Member Function Documentation

void AddToLinkedList ( )
private
virtual void Awake ( )
protectedvirtual
void ConfigureUniqueID ( )
private
static void FindAllModifiers ( )
static
static List<T> GetModifiersOfType< T > ( )
staticprotected
Type Constraints
T :GraphModifier 
virtual void OnDestroy ( )
protectedvirtual
virtual void OnDisable ( )
protectedvirtual

Removes this modifier from list of active modifiers.

Reimplemented in NodeLink3, and NodeLink2.

virtual void OnEnable ( )
protectedvirtual

Adds this modifier to list of active modifiers.

Reimplemented in NodeLink3, and NodeLink2.

virtual void OnGraphsPostUpdate ( )
virtual

Called after graphs have been updated using GraphUpdateObjects.

Eventual flood filling has been done

Reimplemented in NodeLink3, NodeLink2, and NodeLink.

virtual void OnGraphsPreUpdate ( )
virtual

Called before graphs are updated using GraphUpdateObjects.

virtual void OnLatePostScan ( )
virtual

Called at the end of the scanning procedure.

This is the absolute last thing done by Scan.

Reimplemented in RVONavmesh.

virtual void OnPostCacheLoad ( )
virtual

Called after cached graphs have been loaded.

When using cached startup, this event is analogous to OnLatePostScan and implementing scripts should do roughly the same thing for both events.

Reimplemented in RVONavmesh.

virtual void OnPostScan ( )
virtual

Called right after all graphs have been scanned.

FloodFill and other post processing has not been done.

Warning
Since OnEnable and Awake are called roughly in the same time, the only way to ensure that these scripts get this call when scanning in Awake is to set the Script Execution Order for AstarPath to some time later than default time (see Edit -> Project Settings -> Script Execution Order).
Todo:
Is this still relevant? A call to FindAllModifiers should have before this method is called so the above warning is probably not relevant anymore.
See Also
OnLatePostScan

Reimplemented in GraphUpdateScene, NodeLink3, NodeLink2, and NodeLink.

virtual void OnPreScan ( )
virtual

Called right before graphs are going to be scanned.

Warning
Since OnEnable and Awake are called roughly in the same time, the only way to ensure that these scripts get this call when scanning in Awake is to set the Script Execution Order for AstarPath to some time later than default time (see Edit -> Project Settings -> Script Execution Order).
Todo:
Is this still relevant? A call to FindAllModifiers should have before this method is called so the above warning is probably not relevant anymore.
See Also
OnLatePostScan
void RemoveFromLinkedList ( )
private
void Reset ( )
private
static void TriggerEvent ( GraphModifier.EventType  type)
static

Triggers an event for all active graph modifiers.

Member Data Documentation

GraphModifier next
private
GraphModifier prev
private
GraphModifier root
staticprivate

All active graph modifiers.

ulong uniqueID
protected

Unique persistent ID for this component, used for serialization.

Dictionary<ulong, GraphModifier> usedIDs = new Dictionary<ulong, GraphModifier>()
staticprotected

Maps persistent IDs to the component that uses it.


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