Add sound effect hooks to weather effects (#5641)

* Add sound effect hooks to WeatherEffectAnimator

Audio clips for weather sounds (assign in Inspector):
- rainLoopSound: gentle pitter-patter for normal rain
- thunderstormLoopSound: more intense rain for thunderstorm
- thunderSound: one-shot thunder clap (plays on lightning flash)
- blizzardLoopSound: intense wind sound

Volume controls:
- loopVolume: volume for looping sounds (default 0.5)
- thunderVolume: volume for thunder (default 0.8)

Sound behavior:
- Rain: plays rainLoopSound continuously
- Thunderstorm: plays thunderstormLoopSound + thunderSound on each flash
- Snow: no sound
- Blizzard: plays blizzardLoopSound continuously
- Sun/Clouds: no sound

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Support multiple thunder sounds with random selection

- Change thunderSound field to thunderSounds array
- Each lightning flash picks a random sound from the array
- Allows assigning Lightning Spelll 01-08 for variety

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add rain loop sound effect from Freesound

- rain_loop.ogg by aesqe (CC BY 4.0)
- Source: https://freesound.org/people/aesqe/sounds/37618/
- Rain falling on clay roof tiles, loopable
- Added attribution to docs/ASSET_AUDIT.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Document CC BY 4.0 sound effects for weather and runaway

Added to ASSET_AUDIT.md:
- rain_loop.ogg by aesqe (Freesound #37618) - for rain effect
- blizzard_wind_loop.wav by nsstudios (Freesound #651540) - for blizzard
- runaway.mp3 by Yap_Audio_Production (Freesound #218997) - replaces unlicensed file

Note: Files must be downloaded manually from Freesound (requires login).
Only 1 unlicensed sound effect remaining: failure_horn.mp3

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Remove stray download file

* Add rain and blizzard wind sound effects

- rain_loop.ogg by aesqe (CC BY 4.0, Freesound #37618)
- blizzard_wind_loop.wav by nsstudios (CC BY 4.0, Freesound #651540)

Location: Assets/Shardok/Sounds/

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Replace runaway.mp3 with licensed version

MedievalArmyRunningLoop by Yap_Audio_Production (CC BY 4.0)
Source: https://freesound.org/people/Yap_Audio_Production/sounds/218997/

This resolves the licensing issue for runaway.mp3.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Wire up weather sound effects in scene

- Assign rain_loop.ogg to rainLoopSound
- Assign blizzard_wind_loop.wav to blizzardLoopSound
- Configure thunder sounds array

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-27 17:31:22 -08:00
committed by GitHub
co-authored by Claude Opus 4.5
parent 49af7c7524
commit 481f42d01c
10 changed files with 154 additions and 8 deletions
+1
View File
@@ -10,3 +10,4 @@
src/main/csharp/**/GUI[[:space:]]Pro[[:space:]]Kit*/**/*.ttf !filter !diff !merge
src/main/csharp/**/Modern[[:space:]]UI[[:space:]]Pack/**/*.ttf !filter !diff !merge
*.herodata filter=lfs diff=lfs merge=lfs -text
*.ogg filter=lfs diff=lfs merge=lfs -text
+22 -6
View File
@@ -126,6 +126,23 @@ All 26 tracks have CC licenses with proper attribution:
---
## 2b. Creative Commons Sound Effects
**Location:** `Assets/Shardok/Sounds/`
| File | Description | Artist | License | Source |
|------|-------------|--------|---------|--------|
| `rain_loop.ogg` | Rain falling on clay roof tiles (loopable) | aesqe | CC BY 4.0 | [Freesound #37618](https://freesound.org/people/aesqe/sounds/37618/) |
| `blizzard_wind_loop.wav` | Wind draft loop (indoor recording, loops seamlessly) | nsstudios | CC BY 4.0 | [Freesound #651540](https://freesound.org/people/nsstudios/sounds/651540/) |
**Location:** `Assets/Shardok/soundEffects/`
| File | Description | Artist | License | Source |
|------|-------------|--------|---------|--------|
| `runaway.mp3` | Medieval army running loop (gravel + metal/chain) | Yap_Audio_Production | CC BY 4.0 | [Freesound #218997](https://freesound.org/people/Yap_Audio_Production/sounds/218997/) |
---
## 3. CC0 / Public Domain Assets
### SimpleFileBrowser Icons
@@ -155,11 +172,11 @@ All 26 tracks have CC licenses with proper attribution:
- `undead_break_control.mp3`
- `undead_grew.wav`
**⚠️ MUST REPLACE (2 remaining):**
**⚠️ MUST REPLACE (1 remaining):**
- ~~`anybody.mp3`~~ - **REPLACED** (2026-01-23) with `Positive Effect 6.wav` from Magic Spells Sound Effects LITE
- ~~`burnination.mp3`~~ - **REPLACED** (2026-01-23) with `Magic Element Fire 04.wav` from Medieval Combat Sounds
- `failure_horn.mp3` - licensing issue, no replacement found in purchased assets
- `runaway.mp3` - licensing issue, no replacement found in purchased assets
- ~~`runaway.mp3`~~ - **REPLACED** (2026-01-27) with `MedievalArmyRunningLoop.mp3` from Freesound (CC BY 4.0)
**Presumed from Unity Asset Store purchases (31 files):**
Owner believes these are from: Fantasy Interface Sounds, Medieval Combat Sounds, Magic Spells Sound Effects LITE, and/or Medieval Battle Sound Pack.
@@ -226,11 +243,11 @@ NuGet packages in `Assets/Packages/` all include LICENSE.TXT files:
1. ~~**Clip art images**~~ - **RESOLVED** (2026-01-23): Replaced with properly licensed alternatives
2. **Shardok sound effects** - 2 files remaining:
2. **Shardok sound effects** - 1 file remaining:
- ~~`anybody.mp3`~~ - **REPLACED** (2026-01-23)
- ~~`burnination.mp3`~~ - **REPLACED** (2026-01-23)
- `failure_horn.mp3` - licensing issue, needs replacement
- `runaway.mp3` - licensing issue, needs replacement
- ~~`runaway.mp3`~~ - **REPLACED** (2026-01-27) with Freesound CC BY 4.0
### Low Priority (Verify):
@@ -262,9 +279,8 @@ NuGet packages in `Assets/Packages/` all include LICENSE.TXT files:
**Remaining before public release:**
1. Replace 2 sound effects with licensing issues:
1. Replace 1 sound effect with licensing issue:
- `failure_horn.mp3`
- `runaway.mp3`
**Low priority:**
@@ -199353,6 +199353,22 @@ MonoBehaviour:
blizzardParticleCount: 350
blizzardSpeed: 300
blizzardWindSpeed: 400
rainLoopSound: {fileID: 8300000, guid: 3b9c8d7e6f5a4b2c1d0e9f8a7b6c5d4e, type: 3}
thunderstormLoopSound: {fileID: 8300000, guid: 3b9c8d7e6f5a4b2c1d0e9f8a7b6c5d4e,
type: 3}
thunderSounds:
- {fileID: 8300000, guid: 324eca04cae0a4781b5c1bd6a7a5955b, type: 3}
- {fileID: 8300000, guid: f1940d5078bbed045859964fb3ad172a, type: 3}
- {fileID: 8300000, guid: 6edf5471e3a4a4b48abcdbb9b1acb814, type: 3}
- {fileID: 8300000, guid: fca27949779ca6a49b4a73874bcf0bc7, type: 3}
- {fileID: 8300000, guid: 63fda8f9a84e12f4985a22bf8709b734, type: 3}
- {fileID: 8300000, guid: 442ef00849b735945a1578333fe9f709, type: 3}
- {fileID: 8300000, guid: dc5dd9fbe6c3b7345b12f4a47f25372a, type: 3}
- {fileID: 8300000, guid: 9d5fb6e335d6ddb4ab6b4dad58684c54, type: 3}
- {fileID: 8300000, guid: 44ce3a4496ab2d649b6fc8234156fa14, type: 3}
blizzardLoopSound: {fileID: 8300000, guid: 4c0d9e8f7a6b5c3d2e1f0a9b8c7d6e5f, type: 3}
loopVolume: 0.5
thunderVolume: 0.8
sunOverlay: {r: 1, g: 1, b: 0.9, a: 0.05}
cloudsOverlay: {r: 0.5, g: 0.5, b: 0.6, a: 0.15}
rainOverlay: {r: 0.4, g: 0.45, b: 0.5, a: 0.2}
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2a8b7c6d5e4f3a1b9c0d8e7f6a5b4c3d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,20 @@
fileFormatVersion: 2
guid: 4c0d9e8f7a6b5c3d2e1f0a9b8c7d6e5f
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 1
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
ambisonic: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,20 @@
fileFormatVersion: 2
guid: 3b9c8d7e6f5a4b2c1d0e9f8a7b6c5d4e
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 1
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
ambisonic: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -69,6 +69,27 @@ namespace Shardok {
[Tooltip("Blizzard horizontal wind speed")]
public float blizzardWindSpeed = 400f;
[Header("Sound Effects")]
[Tooltip("Looping rain sound for normal rain (gentle pitter-patter)")]
public AudioClip rainLoopSound;
[Tooltip("Looping rain sound for thunderstorm (more intense)")]
public AudioClip thunderstormLoopSound;
[Tooltip("Thunder clap sounds (random one plays on each lightning flash)")]
public AudioClip[] thunderSounds;
[Tooltip("Looping wind sound for blizzard")]
public AudioClip blizzardLoopSound;
[Tooltip("Volume for looping weather sounds")]
[Range(0f, 1f)]
public float loopVolume = 0.5f;
[Tooltip("Volume for thunder sound")]
[Range(0f, 1f)]
public float thunderVolume = 0.8f;
[Header("Screen Overlay Colors")]
[Tooltip("Sun brightness overlay")]
public Color sunOverlay = new Color(1f, 1f, 0.9f, 0.05f);
@@ -96,6 +117,8 @@ namespace Shardok {
private float _lightningEndTime;
private Color _baseOverlayColor;
private RectTransform _canvasRect;
private AudioSource _loopAudioSource;
private AudioSource _oneShotAudioSource;
private void Start() {
if (weatherCanvas != null) {
@@ -104,6 +127,17 @@ namespace Shardok {
// Initialize with no overlay
if (screenOverlay != null) { screenOverlay.color = Color.clear; }
// Create audio sources for weather sounds
_loopAudioSource = gameObject.AddComponent<AudioSource>();
_loopAudioSource.loop = true;
_loopAudioSource.playOnAwake = false;
_loopAudioSource.volume = loopVolume;
_oneShotAudioSource = gameObject.AddComponent<AudioSource>();
_oneShotAudioSource.loop = false;
_oneShotAudioSource.playOnAwake = false;
_oneShotAudioSource.volume = thunderVolume;
}
/// <summary>
@@ -153,12 +187,14 @@ namespace Shardok {
case Weather.Types.Conditions.Rain:
SetOverlayColor(rainOverlay);
CreateRainParticles(rainParticleCount);
PlayLoopSound(rainLoopSound);
break;
case Weather.Types.Conditions.Thunderstorm:
SetOverlayColor(thunderstormOverlay);
CreateRainParticles(thunderstormParticleCount);
ScheduleNextLightning();
PlayLoopSound(thunderstormLoopSound);
break;
case Weather.Types.Conditions.Snow:
@@ -169,6 +205,7 @@ namespace Shardok {
case Weather.Types.Conditions.Blizzard:
SetOverlayColor(blizzardOverlay);
CreateSnowParticles(blizzardParticleCount, true);
PlayLoopSound(blizzardLoopSound);
break;
default: SetOverlayColor(Color.clear); break;
@@ -180,6 +217,26 @@ namespace Shardok {
if (screenOverlay != null) { screenOverlay.color = color; }
}
private void PlayLoopSound(AudioClip clip) {
if (_loopAudioSource == null || clip == null) return;
_loopAudioSource.clip = clip;
_loopAudioSource.volume = loopVolume;
_loopAudioSource.Play();
}
private void StopLoopSound() {
if (_loopAudioSource != null && _loopAudioSource.isPlaying) { _loopAudioSource.Stop(); }
}
private void PlayThunderSound() {
if (_oneShotAudioSource == null || thunderSounds == null || thunderSounds.Length == 0)
return;
AudioClip clip = thunderSounds[Random.Range(0, thunderSounds.Length)];
if (clip == null) return;
_oneShotAudioSource.volume = thunderVolume;
_oneShotAudioSource.PlayOneShot(clip);
}
private void ClearEffects() {
foreach (var particle in _particles) {
if (particle != null) { Destroy(particle); }
@@ -188,6 +245,7 @@ namespace Shardok {
if (screenOverlay != null) { screenOverlay.color = Color.clear; }
StopLoopSound();
_isLightningFlashing = false;
}
@@ -361,6 +419,7 @@ namespace Shardok {
_isLightningFlashing = true;
_lightningEndTime = Time.time + lightningDuration;
if (screenOverlay != null) { screenOverlay.color = lightningColor; }
PlayThunderSound();
}
}
}