import { LEVELS, Level, LevelNames } from "."; import { Game } from ".."; import { Player, Portal } from "../entities"; import { Grid, Level as LevelSystem, SystemNames } from "../systems"; export class LevelSelection extends Level { constructor() { super(LevelNames.LevelSelection); } public init(game: Game): void { const gridSystem = game.getSystem(SystemNames.Grid); const center = gridSystem.getCenterGrid(); const levelSystem = game.getSystem(SystemNames.Level); const unlocked = levelSystem.getUnlockedLevels(); LEVELS.forEach((level, i) => { if ( !unlocked.has(level.name) || level.name === LevelNames.LevelSelection ) { return; } const portal = new Portal(level.name, { x: i, y: 7 }); game.addEntity(portal); }); const player = new Player(center); game.addEntity(player); } }