Skip to content

Home > @esengine/ecs-framework-monorepo > IScene

IScene interface

场景接口定义

定义场景应该实现的核心功能和属性,使用接口而非继承提供更灵活的实现方式。

Signature:

typescript
export interface IScene

Properties

Property

Modifiers

Type

Description

componentStorageManager

readonly

ComponentStorageManager

组件存储管理器

entities

readonly

EntityList

场景中的实体集合

entityProcessors

readonly

EntityProcessorList

实体系统处理器集合

eventSystem

readonly

TypeSafeEventSystem

事件系统

identifierPool

readonly

IdentifierPool

标识符池

name

string

场景名称

querySystem

readonly

QuerySystem

查询系统

systems

readonly

EntitySystem[]

获取系统列表

Methods

Method

Description

addEntity(entity, deferCacheClear)

添加实体

addEntityProcessor(processor)

添加实体处理器

begin()

开始场景

createEntities(count, namePrefix)

批量创建实体

createEntity(name)

创建实体

destroyAllEntities()

销毁所有实体

end()

结束场景

findEntitiesByTag(tag)

根据标签查找实体

findEntity(name)

查找实体

getEntityProcessor(type)

获取实体处理器

initialize()

初始化场景

onStart()

场景开始运行时的回调

removeEntityProcessor(processor)

移除实体处理器

unload()

场景卸载时的回调

update()

更新场景

基于 MIT 许可证发布