sim-ecs - v0.6.5
    Preparing search index...

    Interface IReadOnlyEntity

    interface IReadOnlyEntity {
        id: string;
        addEventListener<T extends keyof IEventMap>(
            event: T,
            handler: IEventMap[T],
        ): void;
        clone(serde: ISerDe, uuid?: string): IEntity;
        getComponent<T extends object>(component: TTypeProto<T>): undefined | T;
        getComponentCount(): number;
        getComponents(): IterableIterator<object>;
        getTagCount(): number;
        getTags(): IterableIterator<TTag>;
        hasComponent(component: ObjectConstructor | TObjectProto): boolean;
        hasEventListener<T extends keyof IEventMap>(
            event: T,
            handler: IEventMap[T],
        ): void;
        hasTag(tag: TTag): boolean;
        removeEventListener<T extends keyof IEventMap>(
            event: T,
            handler: IEventMap[T],
        ): void;
    }

    Hierarchy (View Summary)

    Index

    Properties

    id: string

    UUID to identify the entity across instances The ID is generated and must be manually maintained when syncing with another instance

    Methods

    • Clone this entity with all of its components and tags. This is done by serializing and de-serializing the entity

      Parameters

      • serde: ISerDe

        SerDe to use for serialization

      • Optionaluuid: string

        UUID of new component

      Returns IEntity

    • Get a component of a certain type which is associated with this entity

      Type Parameters

      • T extends object

      Parameters

      • component: TTypeProto<T>

      Returns undefined | T

    • Check if a certain component is associated with this entity

      Parameters

      • component: ObjectConstructor | TObjectProto

      Returns boolean