omega-game-engine
    Preparing search index...

    Represents the base class for all components that define the behavior of an entity. This class provides the foundational structure for creating custom scripts that can be attached to entities in the scene. It includes lifecycle methods such as initialize, update, and destroy, as well as serialization functions.

    Hierarchy (View Summary)

    Indexable

    • [key: string]: any
    Index

    Constructors

    Properties

    _className: string
    _initialized: boolean = false

    A flag indicating if the behaviour has been initialized.

    _serializationIgnoreKeys: string[]
    _uuid: string
    active: boolean = true

    Indicates whether the behaviour is currently active. An inactive behaviour will not have its update method called.

    name: string = ''
    parent: SceneEntity

    The parent entity to which this behaviour is attached.

    renderLayer: RenderLayer = RenderLayer.OPAQUE

    The render layer this behaviour belongs to. This is used to determine the rendering order of the entity.

    Accessors

    Methods

    • Cleans up resources used by the behaviour. This method is called when the behaviour is about to be destroyed.

      Returns void

    • Draws any visual representation of the behaviour. This is often used for debugging purposes, such as drawing bounding boxes or other gizmos.

      Returns void

    • Initializes the behaviour. This method is called once when the behaviour is first added to an entity.

      Returns boolean

      • True if initialization is successful.
    • Updates the behaviour every frame. This method is called on every frame for active behaviours.

      Parameters

      • elapsed: number

        The time elapsed since the last frame in seconds.

      Returns void

    • Updates the behaviour specifically for editor mode. This method is called on every frame when the engine is in editor mode.

      Parameters

      • elapsed: number

        The time elapsed since the last frame in seconds.

      Returns void

    • A static factory method to create an instance of the behaviour. This method is intended to be overridden by subclasses to provide a way to create instances of the specific behaviour type.

      Parameters

      • Optionalargs: any

        Optional arguments for instantiation.

      Returns EntityBehaviour