* 批量销毁实体
(entities: Entity[])
| 819 | * 批量销毁实体 |
| 820 | */ |
| 821 | public destroyEntities(entities: Entity[]): void { |
| 822 | if (entities.length === 0) return; |
| 823 | |
| 824 | for (const entity of entities) { |
| 825 | entity.setDestroyedState(true); |
| 826 | } |
| 827 | |
| 828 | for (const entity of entities) { |
| 829 | entity.removeAllComponents(); |
| 830 | } |
| 831 | |
| 832 | for (const entity of entities) { |
| 833 | this.entities.remove(entity); |
| 834 | this.querySystem.removeEntity(entity); |
| 835 | |
| 836 | if (isValidHandle(entity.handle)) { |
| 837 | this._handleToEntity.delete(entity.handle); |
| 838 | this.handleManager.destroy(entity.handle); |
| 839 | } |
| 840 | } |
| 841 | |
| 842 | this.querySystem.clearCache(); |
| 843 | this.clearSystemEntityCaches(); |
| 844 | } |
| 845 | |
| 846 | /** |
| 847 | * 从场景中删除所有实体 |
no test coverage detected