import * as THREE from 'three' import IndexedCollection from './IndexedCollection.js' import Floor from './Floor.js' //用于处理楼层 class FloorCollection extends IndexedCollection { constructor(model) { super() this.model = model this.exploded = !1 } add(floor) { super.add(floor) this.model.add(floor) } getIndex(floor) { return floor.floorIndex } build() { this.list.forEach(function (floor) { floor.build() }) } nextFloor(e, t) { return this.index[e.floorIndex + t] || null } getOrMakeFloor(floorIndex) { var floor = this.index[floorIndex] if (!floor) { floor = new Floor(this.model, floorIndex) this.add(floor) } return floor } hide() { this.list.forEach(function (floor) { floor.hide() }) } show() { this.list.forEach(function (floor) { floor.show() }) } getFloorAtPoint(e) { for (var t = null, i = 1 / 0, n = 0; n < this.list.length; n++) { var r = this.list[n], o = r.distanceToPoint(e) ;(!t || i > o) && ((i = o), (t = r)) } return t } } export default FloorCollection