Class: Composite

Composite

Composite is the base class for all composite nodes. Thus, if you want to create new custom composite nodes, you need to inherit from this class. When creating composite nodes, you will need to propagate the tick signal to the children nodes manually. To do that, override the `tick` method and call the `_execute` method on all nodes. For instance, take a look at how the Sequence node inherit this class and how it call its children:

new Composite()

Initialization method.

Methods


contextProperties()


currentChildIndex(tick)

return running child index
Parameters:
Name Type Description
tick Tick
Returns:
of the current running child
Type
number

nonContextChild(index)

checks if the child is a non-contextual child
Parameters:
Name Type Description
index number of a child to check
Returns:
- true if not a context child
Type
boolean

validators()

a composite must have children we can't use super so reuse by copy & paste for now defines validation methods to execute at the editor; if one of them fails, a dashed red border is displayed for the node
Returns:
Type
Array.<Validator>