Game Development Reference
In-Depth Information
Figure 10-44. The default Custom Rolloff (left), and the adjusted curve (right)
7.
In the 2 x 3 layout, click Play and drive the Gnomatic Garden Defender into the
garden, watching the location of the Listener in the falloff curve (the vertical
red line), as the character (camera) moves away from the Audio source.
8.
Stop Play mode.
You are probably thinking the garden is too quiet now. Ideally, it would be nice to have each
zombie bunny come with its own randomly chosen munching sound effect. That way, when it was
exterminated, its sound would go with it. To move the project along, you will just reuse the object
you just made and use a single clip. The only difference is that this one should be turned off when
the zombie bunny count drops to 1.
1.
Duplicate Sound FX Birds, name it Sound FX Munching , and move it to the
center of the garden enclosure .
2.
Load Munching in as its Audio Clip.
3.
Open the ScoreKeeper script, and add the following variable:
public AudioSource munching; // the sound effect component for the overrun garden
Inside the UpdateCount function, at the top of the if (currentBunCount == 0)
clause, add
4.
if (munching) munching.enabled = false; // turn off the munching sound
 
Search WWH ::




Custom Search