Merge branch 'death-sounds'

This commit is contained in:
Ian Woods 2026-06-30 23:13:13 -07:00
commit 2286de6fbc
26 changed files with 313 additions and 12 deletions

View file

@ -126,6 +126,9 @@ namespace TD.Gameplay
/// </summary>
public event System.Action<EnemyHealth> OnDied;
/// <summary>Fired on ALL peers the moment this enemy dies. Use for client-side visuals and audio.</summary>
public event System.Action OnDiedClient;
// ----- Server-only pre-spawn init -------------------------------------
/// <summary>
@ -240,6 +243,7 @@ namespace TD.Gameplay
if (deathAnimator != null)
deathAnimator.SetTrigger(DieHash);
DiedClientRpc();
StartCoroutine(DeathSequence());
}
@ -263,6 +267,12 @@ namespace TD.Gameplay
// mesh sizes substantially, derive this from a collider bounds instead.
public float SelectionRadius => 0.4f;
[ClientRpc]
private void DiedClientRpc()
{
OnDiedClient?.Invoke();
}
private IEnumerator DeathSequence()
{
// Hold while the death animation plays.

View file

@ -166,6 +166,11 @@ namespace TD.Gameplay
}
}
// ----- Events ---------------------------------------------------------
/// <summary>Fired on ALL peers when this tower finishes construction and spawns.</summary>
public event System.Action OnBuiltClient;
// ----- Server-only initialization -------------------------------------
/// <summary>
@ -262,6 +267,8 @@ namespace TD.Gameplay
$"for {ownerSlot.Value} at anchor {anchorTile.Value}. " +
$"IsServer={IsServer}");
}
OnBuiltClient?.Invoke();
}
public override void OnNetworkDespawn()