Table of Contents
-
Lessons
While Switches work on a game object basis and States on a global basis, Game Parameters can be used in both contexts. As described in the previous section, Setting Game Parameters using Wwise-Types, when you have declared a Game Parameter property, you can choose to either use the SetValue() or SetGlobalValue() functions. For the sake of demonstration, let's look at how the Enemy_EvilHead_MovementSpeed Game Parameter is used on a game object basis with each Evil Head.
-
In Unity, go to Audiokinetic > Certification > 301 > Lesson 5 and select Understanding Global and Game Object Scope
In this scene, the Adventurer will be surrounded by three Evil Heads. When one of these Evil Heads tries to attack the Player, it performs a sequence of actions. First, they will look and rotate towards the Adventurer, telegraphing that they are about to attack. Then they will charge towards the Adventurer and, upon colliding with the Adventurer, they will bite. Each of these actions is represented by an informative sound, such that a Player wouldn't even have to see them. In addition, a hover sound will be looping to give the listener a constant indication of where an Evil Head is in relation to the Main Camera. As a somewhat concealed audio cue, the EvilHead_Hover_LP Sound SFX has a Wwise Tremolo Effect, which has its frequency mapped using an RTPC to the individual speed of each Evil Head. This is meant to support the Player's intel on the Evil Heads' current behaviors. No matter how many Evil Heads you will be combatting, only one Game Parameter is needed for this. Let's play the game and connect using the Game Object Profiler to better understand how the Game Parameter can be used on a game object basis.
-
In Wwise, go to Layouts and select Game Object Profiler.
Before connecting, we should focus the observations on the Evil Heads and the Enemy_EvilHead_MovementSpeed only. The Game Object Profiler layout's Game Sync Monitor displays all game objects, but you can use the Object Filter to select specific objects to monitor.
-
In the Game Sync Monitor, next to the Object Filter box, click Browse For Object (…).
-
Select the Enemy_EvilHead_MovementSpeed Game Parameter and click OK.
You're now prepared to watch every object in the Wwise Adventure Game that uses the Enemy_EvilHead_MovementSpeed Game Parameter. Next, let's connect to the game. Because we are only testing, let's disable the ability to take damage.
-
Play the scene, then press ESC to enter the WAG menu and select GOD MODE.
-
In the Wwise toolbar, click Remote, highlight the Wwise Adventure Game (Editor) and click Connect.
-
Avoid the Evil Heads for at least five to ten attacks, but feel free to take a swing at them once in a while.
-
Exit Play mode, and switch back to Wwise.
Do not run towards the Village! It is protected and the EvilHeads will die when nearing it. |
In Wwise, the Game Object Profiler shows all of the EvilHeads overlayed on a single graph.
Whenever the Evil Head charges, you will see a sharp attack curve indicating an increase in movement. When the Evil Head ceases to charge, the curve will decay until the Evil Head is yet again ready to attack. The sudden abrupt increase in a curve is where the Evil Head was attacked by a weapon and thereby interrupted. As you might notice, the Game Parameter curves for each Game Object are not identical. Rather, they describe the individual behavior of each Evil Head. The Enemy_EvilHead_MovementSpeed Game Parameter is set using the SetValue() function, as can be seen in the following SetMovementSpeed() function.
private void SetMovementSpeed(float speed) { MovementRTPC.SetValue(gameObject, speed); }
In the above function, you are sending a 'gameObject' and a 'speed' variable to the SetValue() function. The speed variable is what you want to set the Game Parameter to and the gameObject is the game object that the Enemy_EvilHead_Hover Event was posted onto.
When using a Game Parameter on both a global and game object basis, the game object basis (SetValue()) will always override the global (SetGlobalValue()) for the specified game object. Take the Time_of_Day Game Parameter, which is set on a global basis. If another script were to use the SetValue() function on the same game object, such as the Woodlands Ambience, the SetValue() would simply take over and the Woodlands Ambience would only be dependent on that game-object-defined Game Parameter value. Any further changes to the Time_of_Day Game Parameter on a global basis would, therefore, not affect the Woodlands Ambience. |