Skip to main content

Player and Weapon Sounds

All sound effects in the Tactical Shooter Pack are played via the AudioSource component, specifically the PlayOneShot method. The weapon has a separate method that allows to play a sound with a given pitch and volume: TacticalShooterWeapon.cs
This function is used to randomize firing sounds by tweaking their pitch and volume for more variety. For most of other actions, pitch and volume remain unchanged.

Actions

The Tactical Shooter Pack does not rely on animation events to play sounds. Instead, whenever an action is executed, a respective sound effect will be played:

Movement

Walk and sprint sounds are played at runtime with some delay depending on the current gait value: Gait is the animation value in range [0;2], where 0 stands for idle, 1 for walk and 2 for sprint states. Error allows to control more precisely when to trigger a sound.
Tip: For example, if you set it to zero, the sprinting sounds will be played immediately when gait > 1. Instead, we give animation some more time to blend it and only then we start playing movement sounds.