death sounds, build sounds, better audio management
This commit is contained in:
parent
a7b2d1854d
commit
9f25844657
26 changed files with 313 additions and 12 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue