Files
esengine/packages/core/src/ECS/IScene.ts

155 lines
2.9 KiB
TypeScript
Raw Normal View History

2025-08-12 09:39:07 +08:00
import { Entity } from './Entity';
import { EntityList } from './Utils/EntityList';
import { EntityProcessorList } from './Utils/EntityProcessorList';
import { IdentifierPool } from './Utils/IdentifierPool';
import { EntitySystem } from './Systems/EntitySystem';
import { ComponentStorageManager } from './Core/ComponentStorage';
import { QuerySystem } from './Core/QuerySystem';
import { TypeSafeEventSystem } from './Core/EventSystem';
/**
*
*
* 使
*/
export interface IScene {
/**
*
*/
name: string;
2025-08-12 09:39:07 +08:00
/**
*
*/
readonly entities: EntityList;
/**
*
*/
readonly entityProcessors: EntityProcessorList;
/**
*
*/
readonly identifierPool: IdentifierPool;
/**
*
*/
readonly componentStorageManager: ComponentStorageManager;
/**
*
*/
readonly querySystem: QuerySystem;
/**
*
*/
readonly eventSystem: TypeSafeEventSystem;
/**
*
*/
readonly systems: EntitySystem[];
/**
*
*/
initialize(): void;
/**
*
*/
onStart(): void;
/**
*
*/
unload(): void;
/**
*
*/
begin(): void;
/**
*
*/
end(): void;
/**
*
*/
update(): void;
/**
*
*/
createEntity(name: string): Entity;
/**
* EntitySystem的实体缓存
*/
clearSystemEntityCaches(): void;
2025-08-12 09:39:07 +08:00
/**
*
*/
addEntity(entity: Entity, deferCacheClear?: boolean): Entity;
/**
*
*/
createEntities(count: number, namePrefix?: string): Entity[];
/**
*
*/
destroyAllEntities(): void;
/**
*
*/
findEntity(name: string): Entity | null;
/**
*
*/
findEntitiesByTag(tag: number): Entity[];
/**
*
*/
addEntityProcessor(processor: EntitySystem): EntitySystem;
/**
*
*/
removeEntityProcessor(processor: EntitySystem): void;
/**
*
*/
getEntityProcessor<T extends EntitySystem>(type: new (...args: any[]) => T): T | null;
}
/**
*
*/
export interface ISceneFactory<T extends IScene> {
/**
*
*/
createScene(): T;
}
/**
*
*/
export interface ISceneConfig {
/**
*
*/
name?: string;
}