Hamster Ball VR Project Week 6

This week I was required to add sound into our hamster VR game.

I have performed this task many times, so it was straightforward. Normally, games use FMOD or Wise to make dynamic sound, but we decided to use Unity’s built in audio

My first session included setting up the system that would play the sound. My second session involved getting it playing correctly. I started by making a class to manage the sound playback information I store each AudioSource and information needed to play it, such as looping, in a separate class.  At the start of the application, these sounds are loaded into a dictionary that can be accessed by an enum called Sounds. When a sound wants to be played, the SoundManager plays it without other classes needing to know about the AudioClip. Furthermore, I have a separate class inherit from SoundManager that initializes sounds specific to each scene. This approach is designer friendly. Our designer can swap out AudioClips in the inspector without having to know the code. In addition, since the sounds were documented ahead of time, we can be sure that all the enumeration values are included

Another sound is important in this game, a rolling sound. It fades in and out depending on the velocity of an object. I programmed this in a separate class that can be attached as a component. Currently, the ball, rocks, and other movable objects use it.

SoundManager.cs

 

SoundManagerTests.cs

 

 

Comments are closed.