SceneManager
Methods
addEventListener
addEventListener ( type : string, listener: function ) : null
Adds a listener to an event type.
Parameters:
Name | Type | Required | Description |
---|---|---|---|
type | string | Yes | The type of event to listen to. |
listener | function | Yes | The function that gets called when the event is fired. |
Returns:
Type: null
getCurrentFloor
async getCurrentFloor(): Promise<?FloorObject, Error>
Returns:
Type: Promise< ?FloorObject, Error >
hasEventListener
hasEventListener( type : string, listener: function ) : boolean
Checks if listener is added to an event type.
Parameters:
Name | Type | Required | Description |
---|---|---|---|
type | string | Yes | The type of event to listen to. |
listener | function | Yes | The function that gets called when the event is fired. |
Returns:
Type: null
isCurrentFloor
async isCurrentFloor(floor: SiteObject|FloorObject|null): Promise<boolean, Error>
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
floor | ?SiteObject FloorObject | Yes | - |
Returns:
Type: Promise<boolean, Error>
removeEventListener
removeEventListener ( type : string, listener: function ) : null
Removes a listener from an event type.
Parameters:
Name | Type | Required | Description |
---|---|---|---|
type | string | Yes | The type of the listener that gets removed. |
listener | function | Yes | The listener function that gets removed. |
Returns:
Type: null
setCurrentFloor
async setCurrentFloor(floor: SiteObject|FloorObject|null, animated = true : boolean, options = null : ?SingleFloorAnimationOptions|StackFloorAnimationOptions): Promise<void, Error>
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
floor | ?SiteObject FloorObject | Yes | - | The floor to set, passing null is equivalent than passing the site |
animated | boolean | No | true | |
options | ?SingleFloorAnimationOptions | StackFloorAnimationOptions | object | No | null | If not null, it will overwrite the options used by the FloorAnimation |
Returns:
Type: Promise<void, Error>
setFloorTransition
async setFloorTransition(stepGroundsOrFloors: Array<SiteObject|FloorObject|null>, ghostGroundsOrFloors: Array<SiteObject|FloorObject|null>, animated = true : boolean, options = null : ?SingleFloorAnimationOptions|StackFloorAnimationOptions): Promise<void, Error>
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
stepGroundsOrFloors | Array< null | SiteObject | FloorObject > | Yes | - | Grounds to transition, usually from - to |
stepGroundsOrFloors | Array< null | SiteObject | FloorObject > | Yes | - | Ghost grounds, i.e. the ones not implied directly but that you need to show as a ghost like for example going from floor 1 to 4; 2 & 3 will be ghosts. |
animated | boolean | No | true | |
options | ?SingleFloorAnimationOptions | StackFloorAnimationOptions | object | No | null | If not null, it will overwrite the options used by the FloorAnimation |
Returns:
Type: Promise<void, Error>
Events
SCENE_EVENTS.floor.didChanged
The listener will receive the following parameters
Listener Parameters:
Name | Type | Description |
---|---|---|
data | object | |
data.previous | ?FloorObject | |
data.current | ?FloorObject |
SCENE_EVENTS.floor.willChanged
The listener will receive the following parameters
Listener Parameters:
Name | Type | Description |
---|---|---|
data | object | |
data.previous | ?FloorObject | |
data.current | ?FloorObject |