Vixen
c7401864
csharp
public abstract class BehaviorDecorator

A condition attached to a node, gating entry into it and possibly interrupting it.

Read the guide page for this →

Remarks

Shared by every agent running the tree, exactly like an IAgentAction — so a decorator that needs to remember something declares StateSize and keeps it in the span it is handed. A field here is a field a thousand agents write to.

The surface is Unreal's, in three parts, and each part exists because a real decorator in doc 37 § Part 3 needs it: Evaluate gates entry (every decorator), Finish may rewrite the result on the way out (Inverter, ForceSuccess), and ShouldRepeat may run the node again (Loop, ConditionalLoop).

A class rather than an interface because most decorators want two of the five members and the defaults are the interesting part. It is not a seam — doc 37 § Part 4 lists what is, and a decorator is a node in a closed library rather than a policy a project replaces.

Fields and properties (4)

  • public virtual ObserverAborts Aborts

    What this may interrupt when the keys it reads change.

  • public virtual ReadOnlySpan<BlackboardKey> ObservedKeys

    The blackboard keys it reads.

  • public virtual int StateSize

    How many bytes of per-agent state it needs.

  • public virtual bool Continuous

    Whether it is re-tested every step while the branch it gates is running.

Methods (4)

  • public abstract bool Evaluate(in BehaviorContext context, ReadOnlySpan<byte> state)

    Whether the node may be entered, or may keep running.

  • public virtual void Enter(in BehaviorContext context, Span<byte> state)

    The node is being entered.

  • public virtual ActionStatus Finish(in BehaviorContext context, Span<byte> state, ActionStatus result)

    The node has finished, and this is the last chance to change what that meant.

  • public virtual bool ShouldRepeat(in BehaviorContext context, Span<byte> state, ActionStatus result)

    Whether the node should run again instead of returning.

Used by (27)

  • AbortsNothingDecoratorVixen.Ai.Tests
  • AiSnapshotsVixen.Ai
  • BehaviorDecoratorSlotVixen.Ai
  • BehaviorNodeDefinitionVixen.Ai
  • BehaviorTreeAbortOrderingTestsVixen.Ai.Tests
  • BehaviorTreeInstanceVixen.Ai
  • BehaviorTreeResolverVixen.Ai
  • BlackboardDecoratorVixen.Ai
  • BuildStateVixen.Ai
  • CompareEntriesDecoratorVixen.Ai
  • CompileStateVixen.Ai
  • CompositeDecoratorVixen.Ai
  • ConditionalLoopDecoratorVixen.Ai
  • ConeDecoratorVixen.Ai
  • CooldownDecoratorVixen.Ai
  • CountingDecoratorVixen.Ai.Tests
  • DoesPathExistDecoratorVixen.Ai.Nodes
  • ForceFailureDecoratorVixen.Ai
  • ForceSuccessDecoratorVixen.Ai
  • InverterDecoratorVixen.Ai
  • IsAtLocationDecoratorVixen.Ai
  • LoopDecoratorVixen.Ai
  • PerceivedTargetDecoratorVixen.Ai.Perception
  • RandomChanceDecoratorVixen.Ai
  • SetTagCooldownDecoratorVixen.Ai
  • TagCooldownDecoratorVixen.Ai
  • TimeLimitDecoratorVixen.Ai