ecs/System.js

/**
 * Abstract baseclass for ecs systems
 * 
 * A System is a function that acts on all entites with a certain set of components
 */
class System {
    /**
     * @param {String[]} component_names array of components an entity needs to have to be updated by this system
     * @param {Number} priority optional priority, this decides the execution order of the systems
     */
    constructor(component_names, priority = 0) {
        this.component_names = component_names;
        this.priority = priority;
    }

    init() { }

    /**
     * Called by the entity component system
     */
    update() { }
}

export default System;