Class ScenePlayData

The ScenePlayData provides functionality specific to simulating a SceneInstance. It manages all states such as ScenePlayState.Playing or ScenePlayState.Stopped. To start simulating a scene call ScenePlayData.state.

Hierarchy

  • FrameworkObject
    • ScenePlayData

Constructors

  • Parameters

    • OptionalisInternalConstructor: boolean

    Returns ScenePlayData

Accessors

  • get activeTime(): number
  • Gets the number of seconds that have elapsed since the game was started. This time does not include time passed while the game is paused.

    Returns number

  • get isPrerollPaused(): boolean
  • Checks if the scene is playing, but in a preroll paused state.

    Returns boolean

  • get isSimulationPrerollEnabled(): boolean
  • Enables prerolling.

    Returns boolean

    Prerolling is used to minimized load on the first frames when shaders are compiled. Essentially, components and physics will not be updated during the preroll. However, state change events are called so components are able to initialize their data.

  • set isSimulationPrerollEnabled(value): void
  • Parameters

    • value: boolean

    Returns void

  • get state(): EnumValue<ScenePlayState, number>
  • Updates the play state of the game, making the game stop or start playing. Note the actual state change will be delayed until the next update() call. Use the onPlay/onStopped/onPaused/onUnpaused event to get notified when the change actually happens.

    Returns EnumValue<ScenePlayState, number>

  • set state(value): void
  • Parameters

    Returns void

  • get stateOrNextState(): EnumValue<ScenePlayState, number>
  • Returns the next play state if it's queued or the current play state of the game.

    Returns EnumValue<ScenePlayState, number>

Methods

  • Runs the game for a single frame and then pauses it.

    Returns void

Events

onRequestIsSceneStateChangeAllowed: Event<[SceneInstance, EnumValue<ScenePlayState, number>, EnumValue<ScenePlayState, number>], boolean>

Invoked when the a ScenePlayData instance wants to change the state.

willBackupScene: Event<[], void>

Triggered when the scene will be backed up to restore after a simulation, typically right before play mode is entered.

didBackupScene: Event<[], void>

Triggered when the scene was backed up to restore after a simulation, typically right before play mode is entered.

willRestoreScene: Event<[], void>

Triggered when the scene will be restored after a simulation, typically right before stopped mode is entered.

didRestoreScene: Event<[], void>

Triggered when the scene was restored after a simulation, typically right before stopped mode is entered.

didEnterPlayState: Event<[], void>

Triggered right after the play mode is entered.

didEnterStopState: Event<[], void>

Triggered right after the play mode is exited.

didPause: Event<[], void>

Triggered right after the user pauses play mode.

didUnpause: Event<[], void>

Triggered right after the user unpauses play mode.