* 重建所有索引 * * 清空并重新构建所有查询索引。 * 通常在大量实体变更后调用以确保索引一致性。
()
| 315 | * 通常在大量实体变更后调用以确保索引一致性。 |
| 316 | */ |
| 317 | private rebuildIndexes(): void { |
| 318 | this._entityIndex.byTag.clear(); |
| 319 | this._entityIndex.byName.clear(); |
| 320 | |
| 321 | // 清理ArchetypeSystem和ComponentIndexManager |
| 322 | this._archetypeSystem.clear(); |
| 323 | |
| 324 | for (const entity of this._entities) { |
| 325 | this.addEntityToIndexes(entity); |
| 326 | this._archetypeSystem.addEntity(entity); |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | /** |
| 331 | * 查询包含所有指定组件的实体 |
no test coverage detected