Director <TKnownScenes>
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
Properties
currentScene
Current scene playing in excalibur
currentSceneName
Current scene's name
currentTransition
Current transition if any
publicevents
mainLoader
publicreadonlyrootScene
The default [[Scene]] of the game, use [[Engine.goToScene]] to transition to different scenes.
publicreadonlyscenes
All registered scenes in Excalibur
startScene
Accessors
isInitialized
Returns boolean
publicisTransitioning
Gets whether the director currently transitioning between scenes
Useful if you need to block behavior during transition
Returns boolean
Methods
add
Adds additional Scenes to the game!
Type parameters
- TScene: string
Parameters
name: TScene
sceneOrRoute: Scene<unknown> | SceneConstructor | SceneWithOptions
Returns Director<TKnownScenes | TScene>
assertAdded
Returns the same Director, but asserts a scene DOES exist to the type system
Type parameters
- TScene: string
Parameters
name: TScene
Returns Director<TKnownScenes | TScene>
assertRemoved
Returns the same Director, but asserts a scene DOES NOT exist to the type system
Type parameters
- TScene: string
Parameters
name: TScene
Returns Director<Exclude<TKnownScenes, TScene>>
configureStart
Configures the start scene, and optionally the transition & loader for the director
Typically this is called at the beginning of the game to the start scene and transition and never again.
Parameters
startScene: WithRoot<TKnownScenes>
optionaloptions: StartOptions
Returns void
getDeferredScene
Returns Scene<unknown> | SceneConstructor
getSceneDefinition
Returns a scene by name if it exists, might be the constructor and not the instance of a scene
Parameters
name: string
Returns Scene<unknown> | SceneConstructor
getSceneInstance
Retrieves a scene instance by key if it's registered.
This will call any constructors that were given as a definition
Parameters
scene: string
Returns Scene<unknown>
getSceneName
Parameters
scene: Scene<unknown>
Returns string
goto
Go to a specific scene, and optionally override loaders and transitions
Parameters
destinationScene: string | TKnownScenes
optionaloptions: GoToOptions<any>
Returns Promise<void>
maybeLoadScene
Triggers scene loading if has not already been loaded
Parameters
scene: string
hideLoader: boolean = false
Returns Promise<void>
onInitialize
Initialize the director's internal state
Returns Promise<void>
playTransition
Plays a transition in the current scene
Parameters
transition: Transition
Returns Promise<void>
remove
Parameters
scene: Scene<unknown>
Returns void
swapScene
Swaps the current and destination scene after performing required lifecycle events
Type parameters
- TData = undefined
Parameters
destinationScene: string
optionaldata: TData
Returns Promise<void>
The Director is responsible for managing scenes and changing scenes in Excalibur.
It deals with transitions, scene loaders, switching scenes
This is used internally by Excalibur, generally not mean to be instantiated end users directly.