DoopelPonger
Public Member Functions | Public Attributes | List of all members
BackgroundMusicMixer Class Reference

Manages the different types of background tracks that are being played. More...

Inheritance diagram for BackgroundMusicMixer:
Inheritance graph
[legend]
Collaboration diagram for BackgroundMusicMixer:
Collaboration graph
[legend]

Public Member Functions

void Awake ()
 Initializes the class with the EventManager and sets the max volume. More...
 
void FixedUpdate ()
 Sets the timescale of each background track to match the game speed. More...
 
void SetMaxVolume (float maxVolume)
 Master volume control for sound effects. More...
 
float GetMaxVolume ()
 Returns the master volume for sound effects. More...
 

Public Attributes

BackgroundMusic [] backgroundMusicPrefabs
 
float slowmoTimeScaleMultiplier
 
float timeToFadeIn
 
float timeBeforeTrackChange
 

Detailed Description

Manages the different types of background tracks that are being played.

There are three versions of the background music, each playing the same song but having a slightly different set of instruments. This is done to make the music a little bit less repetative. The mixer handles these tracks by playing them all at the same time but only lets one play at the max volume, all other tracks are muted. When it is time to change tracks only the volumes are changed.

Member Function Documentation

◆ Awake()

void BackgroundMusicMixer.Awake ( )

Initializes the class with the EventManager and sets the max volume.

◆ FixedUpdate()

void BackgroundMusicMixer.FixedUpdate ( )

Sets the timescale of each background track to match the game speed.

◆ GetMaxVolume()

float BackgroundMusicMixer.GetMaxVolume ( )

Returns the master volume for sound effects.

Returns
the current volume for sound effects. Will be between 0 and 1

◆ SetMaxVolume()

void BackgroundMusicMixer.SetMaxVolume ( float  maxVolume)

Master volume control for sound effects.

Parameters
maxVolumeNew volume for sound effects. Clamped between 0 and 1

Member Data Documentation

◆ backgroundMusicPrefabs

BackgroundMusic [] BackgroundMusicMixer.backgroundMusicPrefabs

All the tracks for the background music.

◆ slowmoTimeScaleMultiplier

float BackgroundMusicMixer.slowmoTimeScaleMultiplier

When the game goes in slow motion, the background music slows down as well, but if the music slows down at the same rate as the time step then it sounds really bad. The multiplier makes sure the tracks don't get too slow when going in slow motion.

◆ timeBeforeTrackChange

float BackgroundMusicMixer.timeBeforeTrackChange

The amount of time before the background track changes.

◆ timeToFadeIn

float BackgroundMusicMixer.timeToFadeIn

The amount of time it takes to fade in the background music when the game starts.


The documentation for this class was generated from the following file: