Files
novafarma/old_logic/src_backup_1768938138/scenes/BaseScene.js
2026-01-21 01:08:21 +01:00

59 lines
1.4 KiB
JavaScript

/**
* BaseScene.js
*
* Base class for all game scenes
* Automatically integrates MasterWeatherSystem
*
* All scenes should extend this instead of Phaser.Scene
*/
export default class BaseScene extends Phaser.Scene {
constructor(config) {
super(config);
this.weather = null;
}
/**
* Initialize weather system (call in create())
*
* @param {string} biomeName - Optional biome name for auto-config
*/
initWeather(biomeName = null) {
// Get weather from global manager
if (this.game.weatherManager) {
this.weather = this.game.weatherManager.createForScene(this);
// Set biome if provided
if (biomeName) {
this.weather.setBiomeWeather(biomeName);
this.game.weatherManager.setBiome(biomeName);
}
console.log(`🌦️ Weather initialized for ${this.scene.key}`);
} else {
console.warn('⚠️ GlobalWeatherManager not found! Weather disabled.');
}
}
/**
* Update weather (call in update())
*/
updateWeather(delta) {
if (this.weather) {
this.weather.update(delta);
}
}
/**
* Shutdown (automatic cleanup)
*/
shutdown() {
if (this.game.weatherManager) {
this.game.weatherManager.destroyForScene(this.scene.key);
}
this.weather = null;
}
}