/// <summary> /// Create a sequence node. /// </summary> public BehaviourTreeBuilder Sequence(string name) { var sequenceNode = new SequenceNode(name); if (parentNodeStack.Count > 0) { parentNodeStack.Peek().AddChild(sequenceNode); } parentNodeStack.Push(sequenceNode); return(this); }
/// <summary> /// Runs each child node in sequence. /// Fails for the first child node that fails. /// Moves to the next child when the current running child succeeds. /// Stays on the current child node while it returns running. /// Succeeds when all child nodes have succeeded. /// </summary> public BehaviourTreeBuilder Sequence() { var id = ++_idCounter; var sequenceNode = new SequenceNode(id); if (_parentNodeStack.Count > 0) { _parentNodeStack.Peek().AddChild(sequenceNode); } _parentNodeStack.Push(sequenceNode); return(this); }
/// <summary> /// Create a sequence node. /// </summary> public BehaviourTreeBuilder <T> Sequence(string name, bool skipConditionsIfRunning = true) { int id = ++_idCounter; var sequenceNode = new SequenceNode <T>(name, id, skipConditionsIfRunning) { SequenceId = _sequenceOccurenceCounter, IsDisabled = IsBlacklisted(id) }; _sequenceOccurenceCounter++; if (_parentNodeStack.Count > 0) { _parentNodeStack.Peek().AddChild(sequenceNode); } _parentNodeStack.Push(sequenceNode); return(this); }
void Init() { testObject = new SequenceNode("some-sequence"); }
/// <summary> /// Create a sequence node. /// </summary> public BehaviourTreeBuilder Sequence(string name) { var sequenceNode = new SequenceNode(name); if (parentNodeStack.Count > 0) { parentNodeStack.Peek().AddChild(sequenceNode); } parentNodeStack.Push(sequenceNode); return this; }