MCPcopy Create free account
hub / github.com/esengine/esengine / onDestroy

Method onDestroy

packages/particle/src/systems/ClickFxSystem.ts:402–426  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls 6

getActiveEffectsMethod · 0.80
clearActiveEffectsMethod · 0.80
destroyEntitiesMethod · 0.80
pushMethod · 0.65
getComponentMethod · 0.45
findEntityByIdMethod · 0.45

Tested by

no test coverage detected