little bit of sound

This commit is contained in:
Ian Woods 2026-07-14 23:24:29 -07:00
parent dd87fd6d0a
commit adfc6c106c
2 changed files with 12 additions and 178 deletions

View file

@ -1,5 +1,6 @@
// Assets/_Project/Scripts/Gameplay/BuilderSpells/FireballSpellDefinition.cs
using UnityEngine;
using TD.Audio;
using TD.Core;
namespace TD.Gameplay.BuilderSpells
@ -26,7 +27,13 @@ namespace TD.Gameplay.BuilderSpells
[Tooltip("Seconds before the spawned VFX instance is destroyed.")]
[Min(0f)]
[SerializeField] private float impactVfxLifetime = 2f;
[Header("Impact Sound")]
[Tooltip("Sound played on every peer when this spell resolves successfully. Same " +
"SoundConfig struct TowerBuiltSound uses — reuse a tower's clip directly if " +
"you want the same sound.")]
[SerializeField] private SoundConfig impactSound;
[Header("Fireball")]
[Tooltip("Damage dealt to every enemy within Radius of the target point.")]
[Min(0f)]
@ -56,6 +63,10 @@ namespace TD.Gameplay.BuilderSpells
{
if (impactVfxPrefab != null)
Destroy(Instantiate(impactVfxPrefab, targetPoint, Quaternion.identity), impactVfxLifetime);
if (impactSound.clip != null)
AudioManager.Instance?.Play(impactSound.clip, AudioCategory.TowerFire,
impactSound.RandomPitch(), impactSound.volume);
}
}
}