IntroNarration
This commit is contained in:
15
Assets/Sound/Quarry/Scripts/AnneLiseMain.cs
Normal file
15
Assets/Sound/Quarry/Scripts/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/Sound/Quarry/Scripts/AnneLiseMain.cs.meta
Normal file
2
Assets/Sound/Quarry/Scripts/AnneLiseMain.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8fad2d7a81d63b45aad87edfd322669
|
||||
35
Assets/Sound/Quarry/Scripts/NarratorVO.cs
Normal file
35
Assets/Sound/Quarry/Scripts/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/Sound/Quarry/Scripts/NarratorVO.cs.meta
Normal file
2
Assets/Sound/Quarry/Scripts/NarratorVO.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb5c6632b7606ce43a0b2dbf11215dc8
|
||||
Reference in New Issue
Block a user