From b36cc981d69e1211e17986733fef4c6973ce14a0 Mon Sep 17 00:00:00 2001 From: NovaFarma Dev Date: Sun, 7 Dec 2025 23:39:25 +0100 Subject: [PATCH] elite zombie --- src/systems/WeatherSystem.js | 48 +++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/src/systems/WeatherSystem.js b/src/systems/WeatherSystem.js index f72b390..e7e5ee1 100644 --- a/src/systems/WeatherSystem.js +++ b/src/systems/WeatherSystem.js @@ -13,6 +13,10 @@ class WeatherSystem { this.maxWeatherDuration = 10000; // Random duration logic handles this this.rainEmitter = null; // Replaced manual Array with Emitter + // --- SEASONS Configuration --- + this.seasons = ['spring', 'summer', 'autumn', 'winter']; // Pomlad, Poletje, Jesen, Zima + this.currentSeason = 'spring'; + this.daysPerSeason = 7; // Vsak letni čas traja 7 dni // --- State --- this.currentPhase = 'day'; @@ -57,6 +61,9 @@ class WeatherSystem { this.gameTime -= 24; this.dayCount++; console.log(`🌞 Day ${this.dayCount} started!`); + + // Check for Season Change + this.checkSeasonChange(); } // Update Phase @@ -72,7 +79,9 @@ class WeatherSystem { const hours = Math.floor(this.gameTime); const minutes = Math.floor((this.gameTime - hours) * 60); const timeString = `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}`; - uiScene.clockText.setText(`Day ${this.dayCount} - ${timeString}`); + const seasonIcons = { spring: '🌸', summer: '☀️', autumn: '🍂', winter: '❄️' }; + const seasonIcon = seasonIcons[this.currentSeason] || ''; + uiScene.clockText.setText(`${seasonIcon} Day ${this.dayCount} - ${timeString}`); } } @@ -109,6 +118,9 @@ class WeatherSystem { // --- LAYER 2: Weather Effects (Fog, Rain darkness) --- this.renderWeatherEffects(overlay, width, height); + + // --- LAYER 3: Season Tint --- + this.renderSeasonOverlay(overlay, width, height); } renderDayNight(overlay, width, height) { @@ -275,4 +287,38 @@ class WeatherSystem { // Every 3rd night is a Horde Night return this.dayCount > 0 && this.dayCount % 3 === 0; } + + checkSeasonChange() { + const seasonIndex = Math.floor((this.dayCount - 1) / this.daysPerSeason) % 4; + const newSeason = this.seasons[seasonIndex]; + + if (newSeason !== this.currentSeason) { + this.currentSeason = newSeason; + const seasonNames = { spring: '🌸 Pomlad', summer: '☀️ Poletje', autumn: '🍂 Jesen', winter: '❄️ Zima' }; + console.log(`🌍 Letni čas: ${seasonNames[newSeason]}`); + } + } + + getSeason() { + return this.currentSeason; + } + + getSeasonColor() { + // Barve/overlay za letne čase + const colors = { + spring: { color: 0x90EE90, alpha: 0.1 }, // Svetlo zelena + summer: { color: 0xFFFF00, alpha: 0.05 }, // Rumena + autumn: { color: 0xFF8C00, alpha: 0.15 }, // Oranžna + winter: { color: 0xE0F7FF, alpha: 0.25 } // Belo modra + }; + return colors[this.currentSeason] || { color: 0xFFFFFF, alpha: 0 }; + } + + renderSeasonOverlay(overlay, width, height) { + const seasonData = this.getSeasonColor(); + if (seasonData.alpha > 0) { + overlay.fillStyle(seasonData.color, seasonData.alpha); + overlay.fillRect(0, 0, width, height); + } + } }