* 立即移除实体 * @param entity 要移除的实体
(entity: Entity)
| 63 | * @param entity 要移除的实体 |
| 64 | */ |
| 65 | private removeImmediate(entity: Entity): void { |
| 66 | const index = this.buffer.indexOf(entity); |
| 67 | if (index !== -1) { |
| 68 | this.buffer.splice(index, 1); |
| 69 | this._idToEntity.delete(entity.id); |
| 70 | |
| 71 | // 更新名称索引 |
| 72 | this.updateNameIndex(entity, false); |
| 73 | |
| 74 | // 回收实体ID到ID池 |
| 75 | if (this._scene && this._scene.identifierPool) { |
| 76 | this._scene.identifierPool.checkIn(entity.id); |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * 移除所有实体 |
no test coverage detected