UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

46 lines (39 loc) 851 B
/** * @template S * @author Alex Goldring * @copyright Company Named Limited (c) 2025 */ export class MoveEdge { constructor() { /** * * @type {null|StateNode} */ this.target = null; } /** * Move that leads from source state to the target state * @param {S} inputState * @returns S output state */ move(inputState) { throw new Error("Abstract method, needs to be overridden"); } /** * * @returns {boolean} */ isTargetMaterialized() { return this.target !== null; } /** * @template S * @param {function(S):S} f * @return {MoveEdge<S>} */ static fromFunction(f) { const r = new MoveEdge(); r.move = f; return r; } }