Class TreeNodeAbstract

Basic TreeNode interface for engine's graph.

Hierarchy (view full)

Constructors

Properties

_engine: Engine

Engine instance of the node's graph.

_id: string

Node's ID, generate it with nanoid if applicable.

_isLoaded: boolean

Get wether the node is loaded.

_parent: Engine | TreeNode

Node's parent node, if root node, the parent node is replaced by the engine instance.

Accessors

Methods

  • Adds a child node to the node children.

    This method needs to be implemented to throw an error if the node cannot have children (outer nodes).

    Parameters

    Returns number

    New children array length.

  • Called at each fixed step of the loop by the parent node load method or the engine's step method directly.

    It calls the node's onFixedStep method. In the case of an inner node, this method will call the children's fixedStep methods too.

    Returns void

  • Called at node loading in the scene graph.

    It calls the node's onLoad method. In the case of an inner node, this method will call the children's load methods too.

    Returns void

  • To execute on instance creation (in the node's constructor).

    This method is not called in the abstract TreeNode class constructor because it needs to be called after all members are initialized.

    We do not need a create method as this is an internal behavior of nodes.

    Returns void

  • To execute at each step of the loop.

    Parameters

    • delta: number

    Returns void

  • Removes a child node from the node children.

    This method needs to be implemented to throw an error if the node cannot have children (outer nodes).

    Parameters

    • node: TreeNode

      Node to remove of children.

    Returns TreeNode

    Removed node instance.

  • Called at each step of the loop by the parent node load method or the engine's step method directly.

    It calls the node's onStep method. In the case of an inner node, this method will call the children's step methods too.

    Parameters

    • delta: number

    Returns void

  • Called at node unloading in the scene graph.

    It calls the node's onUnload method. In the case of an inner node, this method will call the children's unload methods too.

    Returns void