Class BehaviorTreeNode
Base class for Behavior Tree nodes.
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public abstract class BehaviorTreeNode : SerializableScriptingObject, ISerializable
Constructors
BehaviorTreeNode()
Properties
_executionIndex
Execution index of the node within tree.
Declaration
[Unmanaged]
protected int _executionIndex { get; }
Property Value
System.Int32
|
_memoryOffset
Raw memory byte offset from the start of the behavior memory block.
Declaration
[Unmanaged]
protected int _memoryOffset { get; }
Property Value
System.Int32
|
_parent
Parent node that owns this node (parent composite or decorator attachment node).
Declaration
[Unmanaged]
protected BehaviorTreeNode _parent { get; }
Property Value
BehaviorTreeNode
|
Name
Node user name (eg. Follow Enemy, or Pick up Weapon).
Declaration
[Unmanaged]
public string Name { get; set; }
Property Value
System.String
|
Methods
FreeState(IntPtr)
Frees the allocated node state at the given memory address.
Declaration
public void FreeState(IntPtr memory)
Parameters
System.IntPtr
memory
|
GetDebugInfo(BehaviorUpdateContext)
Gets the node debug state text (multiline). Used in Editor-only to display nodes state. Can be called without valid Behavior/Knowledge/Memory to display default debug info (eg. node properties).
Declaration
[Unmanaged]
public virtual string GetDebugInfo(BehaviorUpdateContext context)
Parameters
BehaviorUpdateContext
context
Behavior context data. |
Returns
System.String
Debug info text (multiline). |
GetState<T>(IntPtr)
Returns the typed node state at the given memory address.
Declaration
public ref T GetState<T>(IntPtr memory)
where T : struct, ValueType
Parameters
System.IntPtr
memory
|
Returns
T
|
Type Parameters
T
|
GetStateSize()
Gets the node instance state size. A chunk of the valid memory is passed via InitState to setup that memory chunk (one per-behavior).
Declaration
[Unmanaged]
public virtual int GetStateSize()
Returns
System.Int32
|
GetStateSize<T>()
Gets the size in bytes of the given typed node state structure.
Declaration
public static int GetStateSize<T>()
Returns
System.Int32
|
Type Parameters
T
|
Init(BehaviorTree)
Initializes node state. Called after whole tree is loaded and nodes hierarchy is setup.
Declaration
[Unmanaged]
public virtual void Init(BehaviorTree tree)
Parameters
BehaviorTree
tree
Node owner asset. |
InitState(BehaviorUpdateContext)
Initializes node instance state. Called when starting logic simulation for a given behavior. Call constructor of the state container.
Declaration
[Unmanaged]
public virtual void InitState(BehaviorUpdateContext context)
Parameters
BehaviorUpdateContext
context
Behavior update context data. |
NewState(IntPtr, Object)
Sets the node state at the given memory address.
Declaration
public void NewState(IntPtr memory, object state)
Parameters
System.IntPtr
memory
|
System.Object
state
|
ReleaseState(BehaviorUpdateContext)
Cleanups node instance state. Called when stopping logic simulation for a given behavior. Call destructor of the state container.
Declaration
[Unmanaged]
public virtual void ReleaseState(BehaviorUpdateContext context)
Parameters
BehaviorUpdateContext
context
Behavior update context data. |
Update(BehaviorUpdateContext)
Updates node logic.
Declaration
[Unmanaged]
public virtual BehaviorUpdateResult Update(BehaviorUpdateContext context)
Parameters
BehaviorUpdateContext
context
Behavior update context data. |
Returns
BehaviorUpdateResult
Operation result enum. |