/
ivaninvv
/
minus-5
Обзор
Документация
Войти
/
ivaninvv
/
minus-5
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/core/SceneManager.ts
34 строки
854 B
Vladimir Ivanin
new line
18 дек 2025, 22:37
18 дек 2025, 22:37
39eabeb
Код
Авторство
О чём код?
import { Container } from 'pixi.js'; import { Scene } from './Scene'; export class SceneManager { private currentScene: Scene | null = null; private readonly root: Container; constructor(rootStage: Container) { this.root = rootStage; } public async goTo(newScene: Scene) { if (this.currentScene) { await this.currentScene.exit(); this.root.removeChild(this.currentScene); this.currentScene.destroy({ children: true }); // Clean up old scene } this.currentScene = newScene; this.root.addChild(this.currentScene); await this.currentScene.enter(); } public update(delta: number) { if (this.currentScene) { this.currentScene.update(delta); } } public resize(width: number, height: number) { if (this.currentScene) { this.currentScene.resize(width, height); } } }