"use strict"; const StairObjectGame = (function(){ const StairObjectGame = function(hollow_bond, model, material_factory, geometry_factory){ const self = this; this.model = model; this.collider = new StairCollider(hollow_bond, model); const geom_fac = geometry_factory || (hollow_bond.dungeon && hollow_bond.dungeon.geometries && hollow_bond.dungeon.geometries.stair) || new StairGeometryGame(hollow_bond); const mat_fac = material_factory || (hollow_bond.dungeon && hollow_bond.dungeon.materials && hollow_bond.dungeon.materials.stair) || new StairMaterialGame(hollow_bond); const hole = hollow_bond.map && hollow_bond.map.holes ? hollow_bond.map.holes[model.hole_id] : null; const geometry = geom_fac.get_for_stair(model, hole); const material = mat_fac.get(); this.mesh = new THREE.Mesh(geometry, material); const bounds = model.get_world_bounds(); const is_x = (model.wall === "north" || model.wall === "south"); // El punto de anclaje de la geometría se construyó desde [0, 0, 0] hacia adelante const pos_x = is_x ? bounds.x : (bounds.x + bounds.width * 0.5); const pos_y = bounds.y; const pos_z = is_x ? (bounds.z + bounds.depth * 0.5) : bounds.z; this.mesh.position.set(pos_x, pos_y, pos_z); this.destroy = () => { if(self.mesh && self.mesh.parent){ self.mesh.parent.remove(self.mesh); } }; }; return StairObjectGame; })();