Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TreeNode Abstract

Basic TreeNode interface for engine's graph.

Hierarchy

Index

Constructors

Properties

_id: string

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

_parent: Engine | TreeNode

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

engine: Engine

Engine instance of the node's graph.

isLoaded: boolean

Get wether the node is loaded.

Accessors

  • get id(): string

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.

  • fixedStep(): void
  • 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

  • load(): 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

  • onCreate(): 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

  • onFixedStep(): void
  • onLoad(): void
  • onStep(): void
  • onUnload(): 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.

  • step(): void
  • 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.

    Returns void

  • unload(): 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

Generated using TypeDoc