()
| 400 | } |
| 401 | |
| 402 | protected override onDestroy(): void { |
| 403 | // 清理所有特效 | Clean up all effects |
| 404 | if (this.scene) { |
| 405 | const entities = this.scene.entities.buffer; |
| 406 | for (let i = 0; i < entities.length; i++) { |
| 407 | const entity = entities[i]; |
| 408 | const clickFx = entity.getComponent(ClickFxComponent); |
| 409 | if (clickFx) { |
| 410 | for (const effect of clickFx.getActiveEffects()) { |
| 411 | const effectEntity = this.scene.findEntityById(effect.entityId); |
| 412 | if (effectEntity) { |
| 413 | this._entitiesToDestroy.push(effectEntity); |
| 414 | } |
| 415 | } |
| 416 | clickFx.clearActiveEffects(); |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | // 立即销毁 | Destroy immediately |
| 421 | if (this._entitiesToDestroy.length > 0) { |
| 422 | this.scene.destroyEntities(this._entitiesToDestroy); |
| 423 | this._entitiesToDestroy = []; |
| 424 | } |
| 425 | } |
| 426 | } |
| 427 | } |
nothing calls this directly
no test coverage detected