* 销毁WorldManager
()
| 363 | * 销毁WorldManager |
| 364 | */ |
| 365 | public destroy(): void { |
| 366 | logger.info('正在销毁WorldManager...'); |
| 367 | |
| 368 | // 停止所有World |
| 369 | this.stopAll(); |
| 370 | |
| 371 | // 销毁所有World |
| 372 | const worldNames = Array.from(this._worlds.keys()); |
| 373 | for (const worldName of worldNames) { |
| 374 | this.removeWorld(worldName); |
| 375 | } |
| 376 | |
| 377 | this._worlds.clear(); |
| 378 | this._isRunning = false; |
| 379 | |
| 380 | logger.info('WorldManager已销毁'); |
| 381 | } |
| 382 | |
| 383 | /** |
| 384 | * 实现 IService 接口的 dispose 方法 |