General Nodes

This page describes the core nodes which have could be used directly in any other project (unlike the Specific Nodes which interact with other systems in the Platformer Game Kit).

Groups

GroupNodes contain an array of child nodes which they execute in different ways:

Node Description Pseudo-Code
Selector Executes each child until one returns Result.Pass similar to the || operator in C#.
if (Children[0].Execute() ||
    Children[1].Execute() ||
    Children[2].Execute() ||
    ...
Sequence Executes each child until one returns Result.Pending or Result.Fail similar to the && operator in C#.
if (Children[0].Execute() &&
    Children[1].Execute() &&
    Children[2].Execute() &&
    ...

Modifiers

ModifierNodes contain a single child which they Execute and modify the result of:

Node Description Pseudo-Code
Ignore Executes the child then ignores its result and returns a fixed result.
[SerializeField] Result _Result;
...
Child.Execute();
return _Result;
Invert Executes the child and reverses its result so Result.Pass becomes Result.Fail and vice-versa. Result.Pending is unchanged.
switch (Child.Execute())
{
    case Result.Pending: return Result.Pending;
    case Result.Pass: return Result.Fail;
    case Result.Fail: return Result.Pass;
}

Leaves

LeafNodes execute individual logic and don't have any children:

Node Description
ActionNode Invokes a System.Action Delegate. Returns Result.Pass as long as no Exception is thrown. Otherwise Result.Fail. This node is not serializable.
FuncNode Invokes a System.Func<Result> Delegate. Returns the result of the invocation. This node is not serializable.
UnityEventNode Invokes a UnityEvent. Returns Result.Pass as long as no Exception is thrown. Otherwise Result.Fail.
Wait Returns Result.Pending and increments a timer before returning Result.Pass once and resetting the timer.

Most LeafNodes are Specific Nodes.