nPhoenix

ScenesManager.js

Feb 26th, 2021
645
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import Phaser from "phaser";
  2.  
  3. class ScenesManager {
  4.     constructor () {
  5.         this.overworld;
  6.         this.level;
  7.         this.battle;
  8.     }
  9.  
  10.     setOverworld (scene) {
  11.         this.overworld = scene;
  12.     }
  13.  
  14.     setLevel (scene) {
  15.         this.level = scene;
  16.     }
  17.  
  18.     setBattle (scene) {
  19.         this.battle = scene;
  20.     }
  21.  
  22.     getOverworld () {
  23.         return this.overworld;
  24.     }
  25.  
  26.     getLevel () {
  27.         return this.level;
  28.     }
  29.  
  30.     getBattle () {
  31.         return this.battle;
  32.     }
  33.  
  34.     destroy (scene) {
  35.         if (scene in this && this[scene] instanceof Phaser.Scene) {
  36.             this[scene].destroy();
  37.             return true;
  38.         };
  39.  
  40.         return false;
  41.     }
  42.  
  43.     destroyAll () {
  44.         Object.keys(this)
  45.             .filter(attr => attr instanceof Phaser.Scene)
  46.             .forEach(scene => scene.destroy());
  47.     }
  48.  
  49.     static ref
  50. }
  51.  
  52.  
  53. export default ScenesManager;
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×