import { GdEnemy, GdImage, GdLevel, GdSimulation, GdTower } from "./index.js";

export class GdRoot {
    public images: { [key: string]: HTMLImageElement } = {};
    public enemies: GdEnemy[] = [];
    public towers: GdTower[] = [];
    public levels: GdLevel[] = [];
    public simulation: GdSimulation = new GdSimulation();

    async loadAsync() {
        GdEnemy.addEnemies(this);
        GdLevel.addLevels(this);
        GdTower.addTowers(this);
        await GdImage.addImagesAsync(this);
    }

    image(name: string): HTMLImageElement {
        return this.images[name] as HTMLImageElement;
    }
}
