Eye of the Nile Docs
Everything you need to know to get started!
Loading...
Searching...
No Matches
AudioManager Class Reference

Detailed Description

Responsible for storing and playing the game's music and sound effects using the FMOD package. To trigger a sound effect from a script, use "AudioManager.instance.PlaySFX()" or any of the other functions here.

Documentation updated 2/2/2025

Author
Stephen Nuttall (old version also authored by Nick Bottari and Alexander Art)
Todo

Make pausing/unpausing the game pause/unpause all game sounds.

Stop all sounds when exiting to main menu and play main menu theme.

Public Member Functions

void PlaySFX (EventReference sound)
 Basic function to play a given sound once.
 
void PlayOneShot (EventReference sound, Vector2 worldPos)
 Plays a short sound once from a given location.
 
void PlayMusic (EventReference musicRef)
 Plays a sound (expected to be music) continously, stopping any track currently playing unless it's the same as the parameter.
 
void StopMusic ()
 Stops the currently playing music.
 
void VolumeChanged ()
 Updates the volume each audio bus plays at.
 

Static Public Attributes

static AudioManager instance
 To make the object persistent, it needs a reference to itself.
 

Private Member Functions

void Awake ()
 Make this object persistent and set reference to data manager. If this is the only AudioManager in the scene, don’t destroy it on reload. If there’s another AudioManager in the scene, destroy it.
 

Private Attributes

DataManager dataManager
 Reference to the data manager.
 
EventReference currentMusicReference
 Reference to the music that is currently playing.
 
EventInstance currentMusicInstance
 

Member Function Documentation

◆ Awake()

void AudioManager.Awake ( )
private

Make this object persistent and set reference to data manager. If this is the only AudioManager in the scene, don’t destroy it on reload. If there’s another AudioManager in the scene, destroy it.

◆ PlayMusic()

void AudioManager.PlayMusic ( EventReference musicRef)

Plays a sound (expected to be music) continously, stopping any track currently playing unless it's the same as the parameter.

◆ PlayOneShot()

void AudioManager.PlayOneShot ( EventReference sound,
Vector2 worldPos )

Plays a short sound once from a given location.

◆ PlaySFX()

void AudioManager.PlaySFX ( EventReference sound)

Basic function to play a given sound once.

◆ StopMusic()

void AudioManager.StopMusic ( )

Stops the currently playing music.

◆ VolumeChanged()

void AudioManager.VolumeChanged ( )

Updates the volume each audio bus plays at.

Member Data Documentation

◆ currentMusicInstance

EventInstance AudioManager.currentMusicInstance
private

◆ currentMusicReference

EventReference AudioManager.currentMusicReference
private

Reference to the music that is currently playing.

◆ dataManager

DataManager AudioManager.dataManager
private

Reference to the data manager.

◆ instance

AudioManager AudioManager.instance
static

To make the object persistent, it needs a reference to itself.


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