refactor: centralize system names, component types, entity types, and animation states into a new Constants module.

This commit is contained in:
Juan Sebastián Montoya 2026-01-06 18:58:12 -05:00
parent e9db84abd1
commit 3db2bb9160
20 changed files with 385 additions and 313 deletions

View file

@ -1,17 +1,18 @@
import { System } from '../core/System.js';
import { SystemName, ComponentType } from '../core/Constants.js';
export class MovementSystem extends System {
constructor() {
super('MovementSystem');
this.requiredComponents = ['Position', 'Velocity'];
super(SystemName.MOVEMENT);
this.requiredComponents = [ComponentType.POSITION, ComponentType.VELOCITY];
this.priority = 10;
}
process(deltaTime, entities) {
entities.forEach(entity => {
const position = entity.getComponent('Position');
const velocity = entity.getComponent('Velocity');
const health = entity.getComponent('Health');
const position = entity.getComponent(ComponentType.POSITION);
const velocity = entity.getComponent(ComponentType.VELOCITY);
const health = entity.getComponent(ComponentType.HEALTH);
if (!position || !velocity) return;