50 lines
1.2 KiB
JavaScript
50 lines
1.2 KiB
JavaScript
import { World } from '../../ecs/index';
|
|
export class ECSScene {
|
|
constructor(instance) {
|
|
this.instance = instance;
|
|
this.running = true;
|
|
this.id = 'ECSScene';
|
|
this.world = new World();
|
|
}
|
|
update() {
|
|
if (this.running)
|
|
this.world.run();
|
|
}
|
|
updateDraw() {
|
|
return true;
|
|
}
|
|
onActivate(manager) {
|
|
this.running = true;
|
|
}
|
|
onDeactivate() {
|
|
this.running = false;
|
|
}
|
|
onSwitch() {
|
|
return;
|
|
}
|
|
createEntity(components) {
|
|
return this.world.createEntity(components);
|
|
}
|
|
createComponent(props) {
|
|
return this.world.createComponent(props);
|
|
}
|
|
createSystem(systemExecutor) {
|
|
return this.world.createSystem(systemExecutor);
|
|
}
|
|
addSystem(system) {
|
|
return this.world.addSystem(system);
|
|
}
|
|
addEntity(entity) {
|
|
return this.world.addEntity(entity);
|
|
}
|
|
removeEntity(entity) {
|
|
return this.world.removeEntity(entity);
|
|
}
|
|
createQuery(include, exclude) {
|
|
return this.world.createQuery(include, exclude);
|
|
}
|
|
extendEntity(entity, components) {
|
|
return this.world.extendEntity(entity, components);
|
|
}
|
|
}
|