* 销毁World
()
| 418 | * 销毁World |
| 419 | */ |
| 420 | public destroy(): void { |
| 421 | logger.info(`销毁World: ${this.name}`); |
| 422 | |
| 423 | this.stop(); |
| 424 | |
| 425 | for (const sceneName of Array.from(this._scenes.keys())) { |
| 426 | this.removeScene(sceneName); |
| 427 | } |
| 428 | |
| 429 | for (const system of this._globalSystems) { |
| 430 | if (system.destroy) { |
| 431 | system.destroy(); |
| 432 | } else { |
| 433 | system.reset?.(); |
| 434 | } |
| 435 | } |
| 436 | this._globalSystems.length = 0; |
| 437 | |
| 438 | this._services.clear(); |
| 439 | this._scenes.clear(); |
| 440 | this._activeScenes.clear(); |
| 441 | } |
| 442 | |
| 443 | /** |
| 444 | * 获取World状态 |