import { Container } from "pixi.js";
import { RoomView } from "./RoomView";
import { RoomTileMap } from "./RoomTileMap";
import { WallMaterial } from "./materials/WallMaterial";
import { FloorMaterial } from "./materials/FloorMaterial";
import { RoomCamera } from "./RoomCamera";
/**
 * Room class for rendering rooms like the ones on Habbo Hotel.
 *
 * @class
 * @memberof Scuti
 */
export class Room extends Container {
    /**
     * @param {Scuti} [engine] - The Scuti instance that will be used to render the room.
     * @param {IRoomConfiguration} [configuration] - The room configuration.
     * @param {string} [configuration.tilemap] - The room tile map that will be parsed.
     * @param {Material} [configuration.floorMaterial] - The room floor material that will be applied.
     * @param {number} [configuration.floorThickness] - The room floor thickness.
     * @param {Material} [configuration.wallMaterial] - The room wall material that will be applied.
     * @param {number} [configuration.wallHeight] - The room wall height.
     * @param {number} [configuration.wallThickness] - The room wall thickness.
     **/
    constructor(engine, configuration) {
        var _a, _b, _c, _d, _e;
        super();
        /** Store variables */
        this._engine = engine;
        this._wallMaterial = (_a = configuration.wallMaterial) !== null && _a !== void 0 ? _a : new WallMaterial(this._engine, 112);
        this._floorMaterial = (_b = configuration.floorMaterial) !== null && _b !== void 0 ? _b : new FloorMaterial(this._engine, 111);
        this._wallThickness = (_c = configuration.wallThickness) !== null && _c !== void 0 ? _c : 8;
        this._floorThickness = (_d = configuration.floorThickness) !== null && _d !== void 0 ? _d : 8;
        this._wallHeight = (_e = configuration.wallHeight) !== null && _e !== void 0 ? _e : 0;
        /** Initialise everything */
        this._tileMap = new RoomTileMap(configuration.tileMap);
        this._view = new RoomView(this);
        this._camera = new RoomCamera(this);
        /** Add the room view and then the room camera to the PixiJS application */
        this.addChild(this._view);
        this._engine.application.stage.addChild(this._camera);
    }
    /**
     * Reference to the game engine instance.
     *
     * @member {Scuti}
     * @readonly
     * @public
     */
    get engine() {
        return this._engine;
    }
    /**
     * Reference to the room view instance.
     *
     * @member {RoomView}
     * @readonly
     * @public
     */
    get view() {
        return this._view;
    }
    /**
     * Reference to the room tile map instance.
     *
     * @member {RoomTileMap}
     * @readonly
     * @public
     */
    get tileMap() {
        return this._tileMap;
    }
    /**
     * Reference to the wall material instance.
     *
     * @member {Material}
     * @readonly
     * @public
     */
    get wallMaterial() {
        return this._wallMaterial;
    }
    /**
     * Update the wall material and rerender the room.
     *
     * @param {Material} [material] - The room wall material that will be applied.
     * @public
     */
    set wallMaterial(material) {
        this._wallMaterial = material;
        this._view.update();
    }
    /**
     * Reference to the floor material instance.
     *
     * @member {Material}
     * @readonly
     * @public
     */
    get floorMaterial() {
        return this._floorMaterial;
    }
    /**
     * Update the floor material and rerender the room.
     *
     * @param {Material} [material] - The room floor material that will be applied.
     * @public
     */
    set floorMaterial(material) {
        this._floorMaterial = material;
        this._view.update();
    }
    /**
     * Reference to the wall thickness.
     *
     * @member {number}
     * @readonly
     * @public
     */
    get wallThickness() {
        return this._wallThickness;
    }
    /**
     * Update the wall thickness and rerender the room.
     *
     * @param {number} [thickness] - The room wall thickness that will be applied.
     * @public
     */
    set wallThickness(thickness) {
        this._wallThickness = thickness;
        this._view.update();
    }
    /**
     * Reference to the floor thickness.
     *
     * @member {number}
     * @readonly
     * @public
     */
    get floorThickness() {
        return this._floorThickness;
    }
    /**
     * Update the floor thickness and rerender the room.
     *
     * @param {number} [thickness] - The room floor thickness that will be applied.
     * @public
     */
    set floorThickness(thickness) {
        this._floorThickness = thickness;
        this._view.update();
    }
    /**
     * Reference to the wall height.
     *
     * @member {number}
     * @readonly
     * @public
     */
    get wallHeight() {
        return this._wallHeight;
    }
    /**
     * Update the wall height and rerender the room.
     *
     * @param {number} [height] - The room wall height that will be applied.
     * @public
     */
    set wallHeight(height) {
        this._wallHeight = height;
        this._view.update();
    }
    /**
     * Reference to the object tile container.
     *
     * @member {RoomTileLayer}
     * @readonly
     * @public
     */
    get tiles() {
        return this._view.tileLayer;
    }
    /**
     * Reference to the object layer container.
     *
     * @member {RoomObjectLayer}
     * @readonly
     * @public
     */
    get objects() {
        return this._view.objectLayer;
    }
}
//# sourceMappingURL=Room.js.map