* 接收迁移的实体 * * 将从其他场景迁移来的实体添加到当前场景。 * * Receive migrated entities from another scene. * * @param entities 要接收的实体数组 | Entities to receive * * @internal
(entities: Entity[])
| 949 | * @internal |
| 950 | */ |
| 951 | public receiveMigratedEntities(entities: Entity[]): void { |
| 952 | for (const entity of entities) { |
| 953 | entity.scene = this; |
| 954 | this.entities.add(entity); |
| 955 | this.querySystem.addEntity(entity); |
| 956 | |
| 957 | for (const component of entity.components) { |
| 958 | this.componentStorageManager.addComponent(entity.id, component); |
| 959 | this.referenceTracker?.registerEntityScene(entity.id, this); |
| 960 | } |
| 961 | } |
| 962 | |
| 963 | if (entities.length > 0) { |
| 964 | this.clearSystemEntityCaches(); |
| 965 | } |
| 966 | } |
| 967 | |
| 968 | /** |
| 969 | * 根据名称查找实体(别名方法) |
no test coverage detected