Last updated: Sep 7, 2022

Introduction

The Play Sound Character Behaviour State Machine Behaviour plays a character-specific sound whenever the Animation State it’s on starts playing. This is very helpful when playing things like a reloading sound that always changes based on the character’s equipped weapon.

This component makes use of our IAudioManagerService implementation to play a sound. This implementation is accessed through our ServiceLocator script.

You can find the Play Sound Character Behaviour at this path: Assets\Infima Games\Low Poly Animated - Modern Guns\Demo\Code\Animation\PlaySoundCharacterBehaviour.cs

Fields Serialized

Delay. Delay at which the audio is played.

Type. Determines the type of sound we're trying to play.

Settings. Settings applied to the AudioClip played when the Animation State this component is on starts playing.

Fields

Player Character. Reference to the player character’s CharacterBehaviour component.

Player Inventory. Reference to the player character’s InventoryBehaviour component.

Audio Manager Service. Reference to our audio playing service.

Last Clip. Last clip played through this component. This is very important so we can delete that last GameObject we created when exiting the state.