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

Plays an AudioSource once and then returns it to the CoopObjectPooler. More...

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

Public Member Functions

void Awake ()
 Initializes the sound effect to be ready to be played. More...
 
void PlaySound (float volume, float pitch)
 Plays the sound effect at the given pitch and volume. More...
 
void PlaySound (float volume)
 Plays the sound effect at the given volume and pitch 1. More...
 
void FixedUpdate ()
 Adjusts the pitch of the sound effect based on the time scale so that things sound lower when in slow motion. More...
 
string GetObjectPoolerKey ()
 
- Public Member Functions inherited from CoopObjectPooler.IObjectPoolerItem
string GetObjectPoolerKey ()
 

Public Attributes

string poolKey
 
float slowmoTimeScaleMultiplier
 
float delay
 
AudioSource audioSourcePrefab
 

Detailed Description

Plays an AudioSource once and then returns it to the CoopObjectPooler.

The PlayOnceAudio class is used to play sound effects. Once the PlaySound method is triggered it will automatically put itself back into the object pooler to be used againin the future.

Member Function Documentation

◆ Awake()

void PlayOnceAudio.Awake ( )

Initializes the sound effect to be ready to be played.

◆ FixedUpdate()

void PlayOnceAudio.FixedUpdate ( )

Adjusts the pitch of the sound effect based on the time scale so that things sound lower when in slow motion.

◆ GetObjectPoolerKey()

string PlayOnceAudio.GetObjectPoolerKey ( )

◆ PlaySound() [1/2]

void PlayOnceAudio.PlaySound ( float  volume,
float  pitch 
)

Plays the sound effect at the given pitch and volume.

Parameters
volumeVolume to play the sound effect at.
pitchPitch to play the sound effect at.

◆ PlaySound() [2/2]

void PlayOnceAudio.PlaySound ( float  volume)

Plays the sound effect at the given volume and pitch 1.

Parameters
volumeVolume to play the sound effect at.

Member Data Documentation

◆ audioSourcePrefab

AudioSource PlayOnceAudio.audioSourcePrefab

◆ delay

float PlayOnceAudio.delay

◆ poolKey

string PlayOnceAudio.poolKey

◆ slowmoTimeScaleMultiplier

float PlayOnceAudio.slowmoTimeScaleMultiplier

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