UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

54 lines (42 loc) 979 B
import List from "../../../../../core/collection/list/List.js"; export class ShadowManager { /** * * @type {GraphicsEngine} * @private */ __graphics = null; /** * * @type {List<ShadowMap>} * @private */ __maps = new List(); set graphics(v) { this.__graphics = v; } /** * * @param {ShadowMap} map */ add(map) { if (this.__maps.contains(map)) { return false; } this.__maps.add(map); map.views.forEach(this.__graphics.views.add, this.__graphics.views); return true; } /** * * @param {ShadowMap} map * @return {boolean} */ remove(map) { const removed = this.__maps.removeOneOf(map); if (removed) { map.views.forEach(this.__graphics.views.remove, this.__graphics.views); } return removed; } }