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

    Class Entity

    Implements

    Index

    Constructors

    Properties

    uuidFn: () => string = ...

    Accessors

    • get id(): string

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

      Returns string

    Methods

    • Add a component to this entity

      Parameters

      • component: object | TObjectProto
      • ...args: readonly unknown[]

      Returns Entity

    • Add a tag to this entity Tagging can be used to mark the entity instead of using an empty marker-component Tags cannot be queried for! They are only markers and should be implemented and used as lean and light-weight as possible.

      Parameters

      Returns Entity

    • 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 Entity

    • 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