Summary
We started this chapter having freshly completed the Main Menu Screen, and we’ve finished it having implemented the Route Planning Screen and the bulk of its core game loop – that’s quite the trip for how short a time we’ve been traveling! SpaceTruckerSoundManager
maintains an internal catalog of all sound assets and makes those assets available to hosting Screens that want to play sounds. Although it seems like it does a lot, when it comes to actual Babylon.js Sounds, it likes to delegate responsibility to the Sound.
The ability to mix different sounds and sources is provided by the different SoundTracks defined by SpaceTruckerSoundManager
, and they make it very easy to have background music playing at the same time as a game sound effect without having to code logic around volume levels. This is because each soundtrack has a volume (gain) control.
After reviewing the GameObject
class hierarchy, we dove – or more appropriately, fell...