import { WorldObject } from './world-object' ; import { Object3D } from 'three' ; export class PortalWorldObject extends WorldObject { private destination ? : PortalWorldObject ; constructor ( private readonly object , private readonly worldName , protected readonly name , private destinationWorldName , private destinationPortalName , private teleportEnabled ) { super ( name ) ; this . addPhysicalObject ( object ) ; } getWorldName ( ) { return this . worldName ; } getDestinationWorldName ( ) { return this . destinationWorldName ; } getDestinationPortalName ( ) { return this . destinationPortalName ; } setDestination ( portal ) { this . destination = portal ; this . destinationWorldName = portal . getWorldName ( ) ; this . destinationPortalName = portal . getName ( ) ; this . show ( ) ; } getDestination ( ) { return this . destination ; } removeDestination ( ) { this . destination = undefined ; this . destinationWorldName = undefined ; this . destinationPortalName = undefined ; this . hide ( ) ; } getName ( ) { return this . name ; } disable ( ) { this . teleportEnabled = false ; } enable ( ) { this . teleportEnabled = true ; } isEnabled ( ) { return this . teleportEnabled && ! ! this . destination ; } makeInvisible ( ) { super . makeInvisible ( ) ; this . object . visible = false ; } makeVisible ( ) { super . makeVisible ( ) ; this . object . visible = true ; } }