Table of Contents
Now you’re ready to integrate your work into Cube. You’ll do this by generating the SoundBank as you have in the last two lessons, but first you have to think about how you’re going to start your player’s heart. Cube has no game call to start the player’s heart. While you could ask the programmer to add one, think about other ways you could accomplish the same thing without programmer involvement. You simply need an event that happens one time when the game is played.
You’re in luck since there is an event that is sent from the game each time you start the game, or load a new level in the game.
This time instead of going to the Event tab in the Project Explorer, you’ll use a shortcut.
-
Right-click in the main area of the Event Viewer and choose New Event > Play.
The New Event dialog box opens showing the Events Folder.
-
In the name field, type Map_Loaded and click OK.
-
Drag the Heartbeat Sound SFX object into the Event Property Editor.
Now when the game is launched, the heartbeat will be started. However, consider that if the player then loads another level, the Map_Loaded Event will be triggered again, causing a second heartbeat to play. If the player moves on to another level, then a third heartbeat plays and so on. Because you've constructed the project so that the heartbeat isn't heard until the player's health is low, the multiple heartbeat issue wouldn't be noticed unless the player's health drops, so this problem might not be immediately noticed. To solve the problem, you'll create two actions for the Map_Loaded Event, one to stop any existing heartbeat from playing and the second to then restart the heart.
-
Drag the Heartbeat Sound SFX object into the Event Property Editor a second time.
The first thing that needs to happen when the Map_Loaded Event is received is to stop any heartbeat that might already be playing, even if its volume isn't loud enough to be heard. Just as you can use the Play action type to play a sound, you can also set an action type to Stop a sound.
-
In the first row's Type column, change the action type from Play to Stop.
It may look as if both the Play and Stop actions will occur at the same time, however the process order will occur in the order as listed, so the heartbeat will first be stopped and then instantaneously restarted.
Now, each time the game is launched, or a new level is loaded, the heartbeat will be stopped before it is played again, preventing any possibility of hearing multiple heartbeats during gameplay. Now you need to add your new events to the Main SoundBank.
-
In the Wwise menu bar, choose Layouts > SoundBank or press F7 and expand the Default Work Unit in the SoundBank Manager view.
You’ll now need to add the Foot_Player and Map_Loaded Events to the SoundBank.
-
In the Event Viewer, drag both the Map_Loaded and Foot_Player to the SoundBank Editor of the Main SoundBank.
-
In the SoundBank Manager, press Generate Selected to generate the SoundBank with your Game Sync integration.