From 2ffad2d86f85b11c9ae473c0a8494cc40ef392d2 Mon Sep 17 00:00:00 2001 From: cha0s Date: Sat, 17 Sep 2022 07:09:02 -0500 Subject: [PATCH] refactor: wrapped system --- packages/ecs/src/ecs.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/ecs/src/ecs.js b/packages/ecs/src/ecs.js index 8fcc058..dd10a62 100644 --- a/packages/ecs/src/ecs.js +++ b/packages/ecs/src/ecs.js @@ -40,14 +40,17 @@ export default class Ecs { const ecs = this; class WrappedSystem extends System { - // eslint-disable-next-line class-methods-use-this - createEntity(components) { - return ecs.create(components); + constructor(Components) { + super(Components); + this.ecs = ecs; + } + + createEntity(components) { + return this.ecs.create(components); } - // eslint-disable-next-line class-methods-use-this createManyEntities(count, components) { - return ecs.createMany(count, components); + return this.ecs.createMany(count, components); } }