GameState
This page is under construction.
Beta feature, subject to change.
GameState is created by a player component and can pass to other main class, such as liveGame.serialize
Public Properties
game
Game- The game instance
audioManager
The game's audio cache and playback manager.
// Fetch and decode a source into the audio cache without playing it.
void gameState.audioManager.preload(bgm);preload(sound: Sound): Promise<void>- warm one source. Available since0.17.0. A source that fails to load is logged as a warning and loads on first play instead, so this never rejects. Do not gate anything on the returned promise: the audio context stays locked until a user gesture satisfies the browser's autoplay policy, so it can legitimately stay pending. See Preloading.
Public Methods
preloadScene
Name the scene whose assets should be warmed, without mounting it or running any of its actions.
gameState.preloadScene(scene); // or a Story, which uses its entry sceneSince 0.17.0 the Player registers the story's entry scene automatically — but only when there is neither a preloading scene nor a mounted scene yet, so calling this first keeps your own choice. See Preloading.
arg: Scene | Story- the scene to warm, or a story whose entry scene is used. Throws if a story is passed and it has no entry scene.return: this