import { Material } from "./Material";
import { Assets, Sprite, Texture } from "pixi.js";
export class WallMaterial extends Material {
    /**
     * @param {Scuti} [engine] - The scuti engine instance to use.
     * @param {number} [id] - The id of the material (it can be found into materials.json).
     **/
    constructor(engine, id) {
        super(0xFFFFFF, Texture.WHITE);
        this._engine = engine;
        this._id = id;
        /** Load the material */
        this._load();
    }
    /**
     * Load the material.
     *
     * @return {void}
     * @private
     */
    _load() {
        const materials = Assets.get('room/materials');
        const material = materials.wallData.walls.find(material => material.id === this._id.toString());
        const { color, materialId } = material.visualizations[0].layers[0];
        const materialTexture = materials.wallData.textures.find(texture => texture.id === materialId.toString());
        const name = materialTexture.bitmaps[0].assetName;
        const texture = Assets.get('room/room').textures[`room_${name}.png`];
        const sprite = new Sprite(texture);
        this.color = color;
        this.texture = new Texture(this._engine.application.renderer.generateTexture(sprite).baseTexture);
    }
}
//# sourceMappingURL=WallMaterial.js.map