evidently-pixi
Version:
TypeScript powered set of modules to make it easier to make games in Pixi.js.
29 lines • 1.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* A class for managing which scene is currently active.
*/
class SceneManager {
/**
* Called every frame, will call `update()` of the current scene.
*
* @param {number} passedTime The time that passed since the last frame in milliseconds
*/
update(passedTime) {
var _a;
(_a = this._currentScene) === null || _a === void 0 ? void 0 : _a.update(passedTime);
}
/**
* Changes the scene calling `onEnded()` on the scene that was previously active and `onStarted()` on the new one.
*
* @param {Scene} newScene The new scene that should replace the old one.
*/
changeScene(newScene) {
var _a;
(_a = this._currentScene) === null || _a === void 0 ? void 0 : _a.onEnded();
this._currentScene = newScene;
this._currentScene.onStarted();
}
}
exports.SceneManager = SceneManager;
//# sourceMappingURL=SceneManager.js.map