ecs-framework icon indicating copy to clipboard operation
ecs-framework copied to clipboard

组件池化

Open esengine opened this issue 3 months ago • 1 comments

当前只有 ComponentPoolManager,但未广泛使用。

下个版本更改为:

@Poolable({ initialSize: 100, maxSize: 1000 })
class PositionComponent extends Component {
  reset() {
    this.x = 0;
    this.y = 0;
  }
}

// 自动池化
entity.addComponent(PositionComponent.create(100, 200));
// 自动回收
entity.removeComponent(position); // -> pool.release(position)

esengine avatar Oct 10 '25 04:10 esengine