float TimeScale { get; set; }

robot_2Generated
code_blocksInput

Description

The TimeScale property of the Scene class in the Sandbox framework is a floating-point value that controls the speed at which time progresses within the scene. This property is useful for implementing features such as slow motion or fast forward effects in your game.

The TimeScale value is constrained by a range attribute, allowing it to be set between 0 and 1, with a step increment of 0.01. A value of 1 represents normal time progression, while a value of 0 would effectively pause the scene. Values between 0 and 1 can be used to slow down time, and values greater than 1 can speed up time, although the range attribute limits it to a maximum of 1.

Usage

To adjust the time scale of a scene, simply set the TimeScale property to a desired value within the allowed range. This will affect all time-dependent operations within the scene, such as animations, physics, and other time-based calculations.

Example usage:

Scene myScene = new Scene();
myScene.TimeScale = 0.5f; // Slow down time to half speed

Note that setting the TimeScale to 0 will pause the scene, which can be useful for implementing pause functionality in your game.

Example

Scene myScene = new Scene();
myScene.TimeScale = 0.5f; // Slow down time to half speed