Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Phaser from "phaser";
- class ScenesManager {
- constructor () {
- this.overworld;
- this.level;
- this.battle;
- }
- setOverworld (scene) {
- this.overworld = scene;
- }
- setLevel (scene) {
- this.level = scene;
- }
- setBattle (scene) {
- this.battle = scene;
- }
- getOverworld () {
- return this.overworld;
- }
- getLevel () {
- return this.level;
- }
- getBattle () {
- return this.battle;
- }
- destroy (scene) {
- if (scene in this && this[scene] instanceof Phaser.Scene) {
- this[scene].destroy();
- return true;
- };
- return false;
- }
- destroyAll () {
- Object.keys(this)
- .filter(attr => attr instanceof Phaser.Scene)
- .forEach(scene => scene.destroy());
- }
- static ref
- }
- export default ScenesManager;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement