AnneLise bird counter implemented
This commit is contained in:
15
Assets/Scripts/Sound/AnneLiseMain.cs
Normal file
15
Assets/Scripts/Sound/AnneLiseMain.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class AnneLiseMain : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PlayIntroVO()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Sound/AnneLiseMain.cs.meta
Normal file
2
Assets/Scripts/Sound/AnneLiseMain.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8fad2d7a81d63b45aad87edfd322669
|
||||
16
Assets/Scripts/Sound/AudioManager.cs
Normal file
16
Assets/Scripts/Sound/AudioManager.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class AudioManager : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Sound/AudioManager.cs.meta
Normal file
2
Assets/Scripts/Sound/AudioManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d8bd90cfc02c8274fac5ce090285ed6a
|
||||
55
Assets/Scripts/Sound/BushAudioController.cs
Normal file
55
Assets/Scripts/Sound/BushAudioController.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using AudioSourceEvents;
|
||||
using Input;
|
||||
using System;
|
||||
using System.Diagnostics.Tracing;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
public class BushAudioController : MonoBehaviour
|
||||
{
|
||||
private IAudioEventSource _eventSource;
|
||||
public AudioSource VOPlayer;
|
||||
public AudioSource SFXPlayer;
|
||||
public AudioResource reactionClipToPlay;
|
||||
public AudioResource flashSFXClipToPlay;
|
||||
|
||||
public BirdGameStats birdGameStats;
|
||||
public AudioResource[] birdCounterClip;
|
||||
private int _birdCounter;
|
||||
|
||||
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
_eventSource = VOPlayer.RequestEventHandlers();
|
||||
_eventSource.AudioStopped += PlayBirdCounter;
|
||||
|
||||
}
|
||||
|
||||
public void PlayPhotoSoundBite()
|
||||
{
|
||||
VOPlayer.resource = reactionClipToPlay;
|
||||
VOPlayer.Play();
|
||||
}
|
||||
|
||||
public void PlayFlashSound()
|
||||
{
|
||||
SFXPlayer.resource = flashSFXClipToPlay;
|
||||
SFXPlayer.Play();
|
||||
}
|
||||
|
||||
private void PlayBirdCounter(object sender, EventArgs e)
|
||||
{
|
||||
VOPlayer.resource = birdCounterClip[birdGameStats.birdsFoundInLevel];
|
||||
VOPlayer.Play();
|
||||
birdGameStats.BirdFound();
|
||||
_eventSource.AudioStopped -= PlayBirdCounter;
|
||||
}
|
||||
|
||||
public void OnDisable()
|
||||
{
|
||||
// Unsubscribe from events when disabled
|
||||
_eventSource.AudioStopped -= PlayBirdCounter;
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Sound/BushAudioController.cs.meta
Normal file
2
Assets/Scripts/Sound/BushAudioController.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: edc43a9f07fedb44abb68b06c71d17ea
|
||||
35
Assets/Scripts/Sound/NarratorVO.cs
Normal file
35
Assets/Scripts/Sound/NarratorVO.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
using AudioSourceEvents;
|
||||
using System;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class NarratorVO : AudioSourceObserver
|
||||
{
|
||||
public AudioSource narratorAudioSource;
|
||||
public AudioResource firstNarration;
|
||||
public UnityEvent narrationFinished;
|
||||
|
||||
private IAudioEventSource _eventSource;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
PlayNarrationAudio();
|
||||
}
|
||||
|
||||
void PlayNarrationAudio()
|
||||
{
|
||||
_eventSource = narratorAudioSource.RequestEventHandlers();
|
||||
_eventSource.AudioStopped += NarrationFinished;
|
||||
|
||||
narratorAudioSource.resource = firstNarration;
|
||||
narratorAudioSource.Play();
|
||||
}
|
||||
|
||||
private void NarrationFinished(object sender, EventArgs e)
|
||||
{
|
||||
narrationFinished.Invoke();
|
||||
}
|
||||
|
||||
}
|
||||
2
Assets/Scripts/Sound/NarratorVO.cs.meta
Normal file
2
Assets/Scripts/Sound/NarratorVO.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb5c6632b7606ce43a0b2dbf11215dc8
|
||||
Reference in New Issue
Block a user