This repository has been archived on 2021-02-20. You can view files and clone it, but cannot push or open issues or pull requests.
shapez.io/src/js/game/game_system.js

44 lines
939 B
JavaScript

/* typehints:start */
import { GameRoot } from "./root";
import { DrawParameters } from "../core/draw_parameters";
/* typehints:end */
/**
* A game system processes all entities which match a given schema, usually a list of
* required components. This is the core of the game logic.
*/
export class GameSystem {
/**
* @param {GameRoot} root
*/
constructor(root) {
this.root = root;
}
///// PUBLIC API /////
/**
* Updates the game system, override to perform logic
*/
update() {}
/**
* Override, do not call this directly, use startDraw()
* @param {DrawParameters} parameters
*/
draw(parameters) {}
/**
* Should refresh all caches
*/
refreshCaches() {}
/**
* @see GameSystem.draw Wrapper arround the draw method
* @param {DrawParameters} parameters
*/
startDraw(parameters) {
this.draw(parameters);
}
}