Options
All
  • Public
  • Public/Protected
  • All
Menu

The builder of behavior tree

Use End to complete build.

Use Build to get an instance of root node.

Basic usage example:

import {behaviorTreeBuilder} from 'ts-behavior-tree';
let root = new behaviorTreeBuilder()
     .Do('something', t => {
         console.log(`Time updated: ${t}`);
     }
).end().build();

Hierarchy

  • BehaviorTreeBuilder

Index

Properties

curNode

curNode: IBehaviorTreeNode | undefined = undefined

parentNodeStack

parentNodeStack: Stack<IParentBehaviorTreeNode> = new Stack<IParentBehaviorTreeNode>()

Methods

Build

Condition

  • Like an action node, but the function can return true/false and is mapped to success/failure.

    Parameters

    • name: string

      name of this node.

    • fn: function

      Things need to be executed.

    Returns BehaviorTreeBuilder

    Builder itself.

Do

End

Inverter

Parallel

  • Parallel(name: string, numRequiredToFail: number, numRequiredToSucceed: number): BehaviorTreeBuilder
  • Create a parallel node.

    Parameters

    • name: string

      name of this node.

    • numRequiredToFail: number

      If number of failures reaches this, then this node will return [[behaviorTreeStatus.Failure]]

    • numRequiredToSucceed: number

      If number of success reaches this, then this node will return [[behaviorTreeStatus.Success]]

    Returns BehaviorTreeBuilder

    Builder itself.

Selector

Sequence

Splice

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc