|
|
|
@ -46,6 +46,9 @@ namespace Fungus
|
|
|
|
|
// True when a voiceover clip is playing |
|
|
|
|
protected bool playingVoiceover = false; |
|
|
|
|
|
|
|
|
|
// Time when current beep will have finished playing |
|
|
|
|
protected float nextBeepTime; |
|
|
|
|
|
|
|
|
|
public virtual void SetAudioMode(AudioMode mode) |
|
|
|
|
{ |
|
|
|
|
audioMode = mode; |
|
|
|
@ -221,10 +224,18 @@ namespace Fungus
|
|
|
|
|
if (playBeeps && beepSounds.Count > 0) |
|
|
|
|
{ |
|
|
|
|
if (!targetAudioSource.isPlaying) |
|
|
|
|
{ |
|
|
|
|
if (nextBeepTime < Time.realtimeSinceStartup) |
|
|
|
|
{ |
|
|
|
|
targetAudioSource.clip = beepSounds[Random.Range(0, beepSounds.Count - 1)]; |
|
|
|
|
targetAudioSource.loop = false; |
|
|
|
|
targetVolume = volume; |
|
|
|
|
targetAudioSource.Play(); |
|
|
|
|
|
|
|
|
|
float extend = targetAudioSource.clip.length; |
|
|
|
|
|
|
|
|
|
nextBeepTime = Time.realtimeSinceStartup + extend; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|