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

Method removeComponent

packages/core/src/ECS/Core/SoAStorage.ts:589–605  ·  view source on GitHub ↗
(entityId: number)

Source from the content-addressed store, hash-verified

587 }
588
589 public removeComponent(entityId: number): T | null {
590 const index = this.entityToIndex.get(entityId);
591 if (index === undefined) {
592 return null;
593 }
594
595 // 获取组件副本以便返回
596 const component = this.getComponent(entityId);
597
598 // 清理复杂字段
599 this.complexFields.delete(entityId);
600
601 this.entityToIndex.delete(entityId);
602 this.freeIndices.push(index);
603 this._size--;
604 return component;
605 }
606
607 private resize(newCapacity: number): void {
608 // 调整数值字段的TypedArray

Callers

nothing calls this directly

Calls 4

getComponentMethod · 0.95
getMethod · 0.65
deleteMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected