Skip to content

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

ComponentStorage class

高性能组件存储器

Signature:

typescript
export declare class ComponentStorage<T extends Component>

Constructors

Constructor

Modifiers

Description

(constructor)(componentType)

Constructs a new instance of the ComponentStorage class

Properties

Property

Modifiers

Type

Description

size

readonly

number

获取组件数量

type

readonly

ComponentType<T>

获取组件类型

Methods

Method

Modifiers

Description

addComponent(entityId, component)

添加组件

clear()

清空所有组件

forEach(callback)

高效遍历所有组件

getComponent(entityId)

获取组件

getDenseArray()

获取所有组件

getStats()

获取存储统计信息

hasComponent(entityId)

检查实体是否有此组件

removeComponent(entityId)

移除组件

基于 MIT 许可证发布