Game Development Reference
In-Depth Information
if(Input.GetButtonUp("Fire2"))
pSpell();
}
When you test the scene, you can click on the left mouse button to play the strike
sound effect. Clicking on the right mouse button will play the spell sound effect. Then,
finally, pressing the
W
key will play the running sound effect.
To playtest the atmospheric sounds, a new empty GameObject will need to be cre-
ated; name it
AtmSource
and be sure to add
AudioSource
and the
ATM_Manager
script to it as well. Set the values of the script to the following:
•
Tmp List
size to
1
•
Element 0
of
Tmp List
to
RainLoop1 - 29 Seconds
•
Keys
size to
1
•
Keys Element 0
to
Rain
•
Atm Volume
to
0.75
Lastly, add this line of code to the end of the
Start
function in the
ATM_Manager
script:
PlayRepeat(atmListt[0].Key);
Now, when you test the scene, you will hear the rain sound effect playing as expec-
ted. The final part to test is the background music, which will be similar to the way
we tested the atmospheric sounds. First, create a new empty GameObject, name it
BGMusicSource
, and add
AudioSource
and
BG_Music_Manager
to it. We will
set most of the script's values to their default values except these two:
•
Song List
size to
1
•
Song List Element 0
to
maintheme_1_the_combat_collection
Now, in the
BG_Music_Manager
script, add this line of code at the end of the
Start
function: