About ‘Trigger Sound Effects’! Question on Laser effects

Thinking about the use of the sounds on prefabs I did made a change on the lecture suggestions, hope @Rick_Davidson will not be mad at me.
Basically we assign the sound of laser to prefab of enemy and player, but what if we want to change the sounds based on the kind of our weapon or enemy weapon shoot ? So I think that it’s better modify the DamageDealer class adding a variable like

[SerializeField] AudioClip shootSound;

So when we load up our prefabs lasers (or any other weapon we would like to add to the game) we assign a specific sound here. For play the audioclip just go on your Enemy and Player class and add the call to the DamageDealer component instantiated when Fire() called like:

 AudioSource.PlayClipAtPoint(laser.GetComponent<DamageDealer>().GetShootSoundClip(), Camera.main.transform.position, fireSoundVolume);

Hope that it will be helpfull for someone :slight_smile:

1 Like

Good stuff.

Still working on lasser pathing and special items(powerups and their movement
LasserDefender 6
)

Privacy & Terms