Skip to content

Commit 1107a20

Browse files
fix: fix the no fire sound problem (external PR #138) (#148)
* fix the no fire sound problem (#138) Co-authored-by: Fernando Cortez <[email protected]> * changelog addition --------- Co-authored-by: Zhanyu Feng <[email protected]>
1 parent a1b5367 commit 1107a20

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Basic/2DSpaceShooter/Assets/Scripts/ShipControl.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,7 @@ public void TakeDamage(int amount)
193193

194194
void Fire(Vector3 direction)
195195
{
196-
fireSound.Play();
197-
196+
PlayFireSoundClientRpc();
198197
var damage = 5;
199198
if (QuadDamageTimer.Value > NetworkManager.ServerTime.TimeAsFloat)
200199
{
@@ -498,6 +497,13 @@ void OnCollisionEnter2D(Collision2D other)
498497
}
499498
}
500499

500+
// --- ClientRPCs ---
501+
502+
[ClientRpc]
503+
void PlayFireSoundClientRpc()
504+
{
505+
fireSound.Play();
506+
}
501507
// --- ServerRPCs ---
502508

503509
[ServerRpc]

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
### Fixed
1717
- Corrected the variables used for initialization of Health and Energy (#150)
1818
- Converted unnecessary ship thrust NetworkVariable to a float (#149)
19+
- Fixed non-host clients not hearing the Fire SFX (#148)
1920

2021
### Client Driven
2122

0 commit comments

Comments
 (0)