// Assets/_Project/Scripts/Combat/TowerLandedSound.cs using TD.Audio; using TD.Gameplay; using UnityEngine; namespace TD.Combat { /// /// Local-only audio for the tower's landing impact. Subscribes to /// and plays a sound on every peer when the /// tower's fall animation () finishes. /// Attach to any tower prefab and assign its clip in the Inspector. /// [RequireComponent(typeof(TowerInstance))] public class TowerLandedSound : MonoBehaviour { [SerializeField] private SoundConfig landedSound; private TowerInstance towerInstance; private void Awake() { towerInstance = GetComponent(); } private void OnEnable() { if (towerInstance != null) towerInstance.OnLandedClient += HandleLanded; } private void OnDisable() { if (towerInstance != null) towerInstance.OnLandedClient -= HandleLanded; } private void HandleLanded() { AudioManager.Instance?.Play(landedSound.clip, AudioCategory.UI, landedSound.RandomPitch(), landedSound.volume); } } }