import { EntityHandle } from './EntityHandle'; import { Component } from './Component'; import { System } from './System'; import { Injector } from './Injector'; import * as EventEmitter from 'eventemitter3'; import { Entity, EntityDecoratorComponent } from './Entity'; export declare class ECS { private static _instance; private constructor(); private static readonly instance; static setPrototypeOf(obj: T, proto: any): T; static readonly Injector: Injector; static noop(): void; /** * create an entity * @param entity {optional} - use existing entity * @param components {optional} - components to add to the entity if provided this will override the current components of the entity if any */ static createEntity(entity?: T | Entity, components?: { [x: string]: Component; }): T & EntityHandle; /** * adds the Entity with the provided components(or existing ones) to the ECS * @param entity - Entity to add to the ECS * @param components - Components for the entity, if provided this will override the current components of the entity if any */ static addEntity(entity: T, components?: { [x: string]: Component; }): T & Entity; /** * Return a list of entities with the specified components * since we need to check all entities this can be quite slow * @param components - list of components the entity needs to have */ static getEntities(...components: { new (config?: { [p: string]: any; }): any; }[]): T[]; /** * removes the entity from the ECS, it will keep all of its components * @param entity - Entity to remove * @returns {Entity} */ static removeEntity(entity: T): T; /** * removes all entities from the ecs */ static removeAllEntities(): Entity[]; static hasEntity(entity: Entity): boolean; static removeComponent(entity: Entity, component: { new (...args: any[]): T; } | string): boolean; static addComponent(entity: Entity, component: Component): void; static addSystem(system: T, componentMask?: { new (config?: { [x: string]: any; }): any; }[]): T; static hasSystem(system: System): boolean; static hasSystemOf(constructor: { new (config?: { [x: string]: any; }): T; }): boolean; static removeSystem(system: System): boolean; static removeSystemOf(constructor: { new (config?: { [x: string]: any; }): T; }): boolean; static getSystemComponentMaskOf(constructor: { new (config?: { [x: string]: any; }): T; }): number; static removeEntityFromSystem(entity: Entity, system?: System): void; static getSystem(constructor: { new (config?: { [x: string]: any; }): T; }): T; static update(a1?: any, a2?: any, a3?: any, a4?: any, a5?: any, a6?: any, a7?: any, a8?: any, a9?: any): void; /** * Calls a specific method for all systems (e.g. update) * @param functionName - name of the function to be called */ static callSystemMethod(functionName: string): void; static addWorker(worker: Worker): void; static init(cb: () => void): void; private static createComponentsFromDecorator; static Component(id?: string): (constructor: { new (...args: any[]): T; }) => any; static System(...components: { new (...args: any[]): object | Component; }[]): (constructor: { new (...args: any[]): System; }) => any; static Entity(...components: EntityDecoratorComponent[]): ((constructor: { new (...args: any[]): T; }) => any); static uuid: () => string; static systemUpdateMethods: string[]; static readonly events: EventEmitter; }