dacha
    Preparing search index...

    Class Entity

    Base class for all entities.

    Hierarchy (View Summary)

    Index
    children: Entity[]

    Children of the entity

    id: string

    Id of the entity

    name: string

    Name of the entity

    parent: Entity | null

    Parent of the entity

    • Adds a child to the entity.

      Parameters

      Returns void

    • Dispatches an event to the event target.

      Events are processed in the engine event queue at the beginning of each frame in order that they were dispatched.

      Parameters

      • type: EventType

        Type of event to dispatch

      • Optionalpayload: Record<string, unknown>

        Payload of the event

      Returns void

    • Dispatches an event to the event target immediately.

      Events are processed immediately and not added to the engine event queue.

      Parameters

      • type: EventType

        Type of event to dispatch

      • Optionalpayload: Record<string, unknown>

        Payload of the event

      Returns void

    • Finds a child entity by a predicate function.

      Parameters

      • predicate: (entity: Entity) => boolean

        A function that runs on each child entity and should return true if the child entity matches the predicate or false otherwise

      • recursive: boolean = true

        Whether to search recursively through the children

      Returns Entity | undefined

      Child entity or undefined

    • Finds a child entity by its id.

      Parameters

      • id: string

        Id of the child entity

      • recursive: boolean = true

        Whether to search recursively through the children

      Returns Entity | undefined

      Child entity or undefined

    • Finds a child entity by its name.

      Parameters

      • name: string

        Name of the child entity

      • recursive: boolean = true

        Whether to search recursively through the children

      Returns Entity | undefined

      Child entity or undefined

    • Removes the entity from its parent.

      Returns void

    • Removes a child from the entity.

      Parameters

      • child: Entity

        Child to remove

      Returns void