Properly queue critical VO clips

This commit is contained in:
journaliciouz
2025-10-30 14:17:47 +01:00
parent 64da60dadd
commit e81879959e
10 changed files with 280 additions and 259 deletions

View File

@@ -8,8 +8,8 @@ using UnityEngine.Audio;
public class BushAudioController : MonoBehaviour
{
private IAudioEventSource _eventSource;
public AudioSource VOPlayer;
public AudioSource SFXPlayer;
public AppleAudioSource VOPlayer;
public AppleAudioSource SFXPlayer;
public AudioResource reactionClipToPlay;
public AudioResource flashSFXClipToPlay;
@@ -22,28 +22,28 @@ public class BushAudioController : MonoBehaviour
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
_eventSource = VOPlayer.RequestEventHandlers();
_eventSource = VOPlayer.audioSource.RequestEventHandlers();
_eventSource.AudioStopped += PlayBirdCounter;
}
public void PlayPhotoSoundBite()
{
VOPlayer.resource = reactionClipToPlay;
VOPlayer.Play();
VOPlayer.audioSource.resource = reactionClipToPlay;
VOPlayer.Play(0);
}
public void PlayFlashSound()
{
SFXPlayer.resource = flashSFXClipToPlay;
SFXPlayer.Play();
SFXPlayer.audioSource.resource = flashSFXClipToPlay;
SFXPlayer.Play(0);
}
private void PlayBirdCounter(object sender, EventArgs e)
{
_eventSource.AudioStopped -= PlayBirdCounter;
VOPlayer.resource = birdCounterClip[birdGameStats.birdsFoundInLevel];
VOPlayer.Play();
VOPlayer.audioSource.resource = birdCounterClip[birdGameStats.birdsFoundInLevel];
VOPlayer.Play(0);
birdGameStats.BirdFound();
}