Finally, priority VO
This commit is contained in:
@@ -6,7 +6,7 @@ AudioMixerGroupController:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: FlavorVO
|
||||
m_Name: Flavor VO
|
||||
m_AudioMixer: {fileID: 24100000}
|
||||
m_GroupID: d96f2f2d9081a2b4680e4cc99ae6dde2
|
||||
m_Children: []
|
||||
@@ -58,7 +58,7 @@ AudioMixerGroupController:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: CriticalVO
|
||||
m_Name: Critical VO
|
||||
m_AudioMixer: {fileID: 24100000}
|
||||
m_GroupID: 0564b669f5b88d74fbf644daddff7659
|
||||
m_Children: []
|
||||
@@ -85,7 +85,7 @@ AudioMixerController:
|
||||
m_StartSnapshot: {fileID: 24500006}
|
||||
m_SuspendThreshold: -80
|
||||
m_EnableSuspend: 1
|
||||
m_UpdateMode: 0
|
||||
m_UpdateMode: 1
|
||||
m_ExposedParameters: []
|
||||
m_AudioMixerGroupViews:
|
||||
- guids:
|
||||
|
||||
@@ -54,6 +54,8 @@ SpriteRenderer:
|
||||
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_ForceMeshLod: -1
|
||||
m_MeshLodSelectionBias: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
@@ -75,6 +77,7 @@ SpriteRenderer:
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_GlobalIlluminationMeshLod: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 1
|
||||
@@ -163,6 +166,8 @@ SpriteRenderer:
|
||||
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_ForceMeshLod: -1
|
||||
m_MeshLodSelectionBias: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
@@ -184,6 +189,7 @@ SpriteRenderer:
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_GlobalIlluminationMeshLod: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 2
|
||||
@@ -214,6 +220,8 @@ GameObject:
|
||||
- component: {fileID: 6455089331794006644}
|
||||
- component: {fileID: 5043618791380611472}
|
||||
- component: {fileID: 4538351495758615844}
|
||||
- component: {fileID: 1474128690748341614}
|
||||
- component: {fileID: 8147035636176183831}
|
||||
m_Layer: 10
|
||||
m_Name: AnneLise_Camera
|
||||
m_TagString: Untagged
|
||||
@@ -439,3 +447,115 @@ BoxCollider2D:
|
||||
m_AutoTiling: 0
|
||||
m_Size: {x: 4, y: 5}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!82 &1474128690748341614
|
||||
AudioSource:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5172497182660285677}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 4
|
||||
OutputAudioMixerGroup: {fileID: -281949353495416486, guid: 727a7e4b6df4b0d47897f7d8ee7fa323, type: 2}
|
||||
m_audioClip: {fileID: 0}
|
||||
m_Resource: {fileID: 0}
|
||||
m_PlayOnAwake: 1
|
||||
m_Volume: 1
|
||||
m_Pitch: 1
|
||||
Loop: 0
|
||||
Mute: 0
|
||||
Spatialize: 0
|
||||
SpatializePostEffects: 0
|
||||
Priority: 128
|
||||
DopplerLevel: 1
|
||||
MinDistance: 1
|
||||
MaxDistance: 500
|
||||
Pan2D: 0
|
||||
rolloffMode: 0
|
||||
BypassEffects: 0
|
||||
BypassListenerEffects: 0
|
||||
BypassReverbZones: 0
|
||||
rolloffCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
panLevelCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
spreadCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
reverbZoneMixCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
--- !u!114 &8147035636176183831
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5172497182660285677}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 242e6101be071f44fb14c3c12641c833, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: AppleHillsScripts::AppleAudioSource
|
||||
audioSourceType: 0
|
||||
audioSource: {fileID: 0}
|
||||
priority: 0
|
||||
|
||||
@@ -45,4 +45,10 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: '::'
|
||||
currentPauseBehavior: 2
|
||||
_audioMixer: {fileID: 24100000, guid: 727a7e4b6df4b0d47897f7d8ee7fa323, type: 2}
|
||||
audioMixer: {fileID: 24100000, guid: 727a7e4b6df4b0d47897f7d8ee7fa323, type: 2}
|
||||
currentlyPlayingVO: {fileID: 0}
|
||||
criticalVOSources: []
|
||||
VOSources: []
|
||||
musicSources: []
|
||||
ambienceSources: []
|
||||
SFXSources: []
|
||||
|
||||
@@ -6,11 +6,12 @@ using Core;
|
||||
using Interactions;
|
||||
using UnityEngine;
|
||||
using PuzzleS;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
namespace Dialogue
|
||||
{
|
||||
[AddComponentMenu("AppleHills/Dialogue/Dialogue Component")]
|
||||
[RequireComponent(typeof(AudioSource))]
|
||||
[RequireComponent(typeof(AppleAudioSource))]
|
||||
public class DialogueComponent : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private RuntimeDialogueGraph dialogueGraph;
|
||||
@@ -19,7 +20,7 @@ namespace Dialogue
|
||||
private int currentLineIndex;
|
||||
private bool initialized = false;
|
||||
private SpeechBubble speechBubble;
|
||||
private AudioSource audioSource;
|
||||
private AppleAudioSource appleAudioSource;
|
||||
|
||||
// Flag to track when a condition has been met but dialogue hasn't advanced yet
|
||||
private bool _conditionSatisfiedPendingAdvance = false;
|
||||
@@ -37,7 +38,7 @@ namespace Dialogue
|
||||
private void Start()
|
||||
{
|
||||
// Get required components
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
appleAudioSource = GetComponent<AppleAudioSource>();
|
||||
speechBubble = GetComponentInChildren<SpeechBubble>();
|
||||
|
||||
if (speechBubble == null)
|
||||
@@ -109,19 +110,19 @@ namespace Dialogue
|
||||
/// Play the audio clip for the current dialogue content
|
||||
/// </summary>
|
||||
/// <param name="clip">Audio clip to play</param>
|
||||
private void PlayDialogueAudio(AudioClip clip)
|
||||
private void PlayDialogueAudio(AudioResource clip)
|
||||
{
|
||||
// Stop any currently playing audio
|
||||
if (audioSource.isPlaying)
|
||||
if (appleAudioSource.audioSource.isPlaying)
|
||||
{
|
||||
audioSource.Stop();
|
||||
appleAudioSource.Stop();
|
||||
}
|
||||
|
||||
// Play the new clip if it exists
|
||||
if (clip != null)
|
||||
{
|
||||
audioSource.clip = clip;
|
||||
audioSource.Play();
|
||||
appleAudioSource.audioSource.resource = clip;
|
||||
appleAudioSource.Play();
|
||||
Logging.Debug($"Playing dialogue audio: {clip.name}");
|
||||
}
|
||||
}
|
||||
|
||||
83
Assets/Scripts/Sound/AppleAudioSource.cs
Normal file
83
Assets/Scripts/Sound/AppleAudioSource.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
using AudioSourceEvents;
|
||||
using System;
|
||||
using System.Diagnostics.Tracing;
|
||||
using UnityEditor.UI;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
/// <summary>
|
||||
/// We automatically add the AudioSource component here so we can control it. Do not add it manually!
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(AudioSource))]
|
||||
public class AppleAudioSource : MonoBehaviour
|
||||
{
|
||||
public enum AudioSourceType{CriticalVO,VO,Ambience,SFX,Music}
|
||||
public AudioSourceType audioSourceType;
|
||||
public AudioSource audioSource;
|
||||
private AudioMixer _audioMixer;
|
||||
|
||||
public int priority;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
AudioManager.Instance.RegisterNewAudioSource(this);
|
||||
_audioMixer = AudioManager.Instance.audioMixer;
|
||||
InitializeAudioSource();
|
||||
|
||||
}
|
||||
|
||||
public void InitializeAudioSource()
|
||||
{
|
||||
// Route the audio to the correct bus depending on type
|
||||
switch (audioSourceType)
|
||||
{
|
||||
case AppleAudioSource.AudioSourceType.CriticalVO:
|
||||
audioSource.outputAudioMixerGroup = _audioMixer.FindMatchingGroups("Critical VO")[0];
|
||||
break;
|
||||
case AppleAudioSource.AudioSourceType.VO:
|
||||
audioSource.outputAudioMixerGroup = _audioMixer.FindMatchingGroups("VO")[0];
|
||||
break;
|
||||
case AppleAudioSource.AudioSourceType.SFX:
|
||||
audioSource.outputAudioMixerGroup = _audioMixer.FindMatchingGroups("SFX")[0];
|
||||
break;
|
||||
case AppleAudioSource.AudioSourceType.Ambience:
|
||||
audioSource.outputAudioMixerGroup = _audioMixer.FindMatchingGroups("Ambience")[0];
|
||||
break;
|
||||
case AppleAudioSource.AudioSourceType.Music:
|
||||
audioSource.outputAudioMixerGroup = _audioMixer.FindMatchingGroups("Music")[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Play()
|
||||
{
|
||||
if (audioSourceType == AudioSourceType.CriticalVO || audioSourceType == AudioSourceType.VO)
|
||||
{
|
||||
if (AudioManager.Instance.RequestPlayVO(this))
|
||||
{
|
||||
audioSource.Play();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("AppleAudioSource " + name + " was suppressed because something more important is playing");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void InterruptAudio(string nameOfInterruptingAudio)
|
||||
{
|
||||
Debug.Log("AppleAudioSource " + name + " was interrupted by source: " + nameOfInterruptingAudio);
|
||||
Stop();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
audioSource.Stop();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
2
Assets/Scripts/Sound/AppleAudioSource.cs.meta
Normal file
2
Assets/Scripts/Sound/AppleAudioSource.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 242e6101be071f44fb14c3c12641c833
|
||||
@@ -4,9 +4,11 @@ using Core;
|
||||
using PuzzleS;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
using Bootstrap;
|
||||
using AppleHills.Core;
|
||||
using AppleHills.Core.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using AudioSourceEvents;
|
||||
using System;
|
||||
|
||||
public class AudioManager : MonoBehaviour, IPausable
|
||||
{
|
||||
@@ -14,17 +16,26 @@ public class AudioManager : MonoBehaviour, IPausable
|
||||
/// Play all audio, just music or no audio at all when the game is paused.
|
||||
/// </summary>
|
||||
public enum PauseBehavior
|
||||
{PlayAllAudio, MusicOnly, NoAudio}
|
||||
{ PlayAllAudio, MusicOnly, NoAudio }
|
||||
|
||||
public PauseBehavior currentPauseBehavior;
|
||||
|
||||
public AudioMixer _audioMixer;
|
||||
public AudioMixer audioMixer;
|
||||
private AudioListener _audioListener;
|
||||
public AppleAudioSource currentlyPlayingVO;
|
||||
|
||||
|
||||
private static AudioManager _instance;
|
||||
private GameObject _player;
|
||||
|
||||
public List<AppleAudioSource> criticalVOSources;
|
||||
public List<AppleAudioSource> VOSources;
|
||||
public List<AppleAudioSource> musicSources;
|
||||
public List<AppleAudioSource> ambienceSources;
|
||||
public List<AppleAudioSource> SFXSources;
|
||||
|
||||
private IAudioEventSource _eventSource;
|
||||
|
||||
/// <summary>
|
||||
/// Singleton instance of the AudioManager.
|
||||
/// </summary>
|
||||
@@ -48,7 +59,11 @@ public class AudioManager : MonoBehaviour, IPausable
|
||||
void Start()
|
||||
{
|
||||
_player = QuickAccess.Instance.PlayerGameObject;
|
||||
_audioListener = QuickAccess.Instance.MainCamera.GetComponent<AudioListener>();
|
||||
_audioListener = QuickAccess.Instance.MainCamera.GetComponent<AudioListener>();
|
||||
foreach (AppleAudioSource _audioSource in criticalVOSources)
|
||||
{
|
||||
Debug.Log("Found source: " + _audioSource.name);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetAudioPauseBehavior(PauseBehavior newPauseBehavior)
|
||||
@@ -56,20 +71,39 @@ public class AudioManager : MonoBehaviour, IPausable
|
||||
switch (newPauseBehavior)
|
||||
{
|
||||
case PauseBehavior.PlayAllAudio:
|
||||
_audioMixer.updateMode = AudioMixerUpdateMode.UnscaledTime;
|
||||
audioMixer.updateMode = AudioMixerUpdateMode.UnscaledTime;
|
||||
AudioListener.pause = false;
|
||||
break;
|
||||
case PauseBehavior.MusicOnly:
|
||||
_audioMixer.updateMode = AudioMixerUpdateMode.UnscaledTime; break;
|
||||
audioMixer.updateMode = AudioMixerUpdateMode.UnscaledTime; break;
|
||||
//TODO: Pause all audio mixers except music mixer
|
||||
case PauseBehavior.NoAudio:
|
||||
_audioMixer.updateMode = AudioMixerUpdateMode.Normal;
|
||||
audioMixer.updateMode = AudioMixerUpdateMode.Normal;
|
||||
AudioListener.pause = true;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public LevelAudioObject GetCurrentLevelAudioObject()
|
||||
{
|
||||
Debug.Log("Audio objects: " + FindObjectsByType<LevelAudioObject>(FindObjectsInactive.Include, FindObjectsSortMode.None).Length);
|
||||
if (FindObjectsByType<LevelAudioObject>(FindObjectsInactive.Include, FindObjectsSortMode.None).Length > 1)
|
||||
{
|
||||
Debug.LogWarning("Warning! More than one LevelAudioObject in the level! Using the first one found");
|
||||
return FindObjectsByType<LevelAudioObject>(FindObjectsInactive.Include, FindObjectsSortMode.None)[0];
|
||||
}
|
||||
if (FindObjectsByType<LevelAudioObject>(FindObjectsInactive.Include, FindObjectsSortMode.None).Length == 0)
|
||||
{
|
||||
Debug.LogWarning("Error! No LevelAudioObject found, AudioManager might not function properly!");
|
||||
return null;
|
||||
}
|
||||
else
|
||||
return FindFirstObjectByType<LevelAudioObject>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
SetAudioPauseBehavior(PauseBehavior.NoAudio);
|
||||
@@ -79,4 +113,94 @@ public class AudioManager : MonoBehaviour, IPausable
|
||||
{
|
||||
SetAudioPauseBehavior(PauseBehavior.PlayAllAudio);
|
||||
}
|
||||
|
||||
public void RegisterNewAudioSource(AppleAudioSource newAudioSource)
|
||||
{
|
||||
switch (newAudioSource.audioSourceType)
|
||||
{
|
||||
case AppleAudioSource.AudioSourceType.CriticalVO:
|
||||
criticalVOSources.Add(newAudioSource);
|
||||
break;
|
||||
case AppleAudioSource.AudioSourceType.VO:
|
||||
VOSources.Add(newAudioSource);
|
||||
break;
|
||||
case AppleAudioSource.AudioSourceType.SFX:
|
||||
SFXSources.Add(newAudioSource);
|
||||
break;
|
||||
case AppleAudioSource.AudioSourceType.Ambience:
|
||||
ambienceSources.Add(newAudioSource);
|
||||
break;
|
||||
case AppleAudioSource.AudioSourceType.Music:
|
||||
musicSources.Add(newAudioSource);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Request playing a VO line. Returns true if whatever is playing is not critical, or weight of requested VO line is lower.
|
||||
/// </summary>
|
||||
public bool RequestPlayVO(AppleAudioSource requestedAudioSource)
|
||||
{
|
||||
|
||||
if (currentlyPlayingVO == null)
|
||||
{
|
||||
currentlyPlayingVO = requestedAudioSource;
|
||||
Debug.Log($"CurrentVO prio: {currentlyPlayingVO.priority} requested VO prio: {requestedAudioSource.priority}");
|
||||
RegisterStartStopEvents(requestedAudioSource.audioSource);
|
||||
return true;
|
||||
}
|
||||
if(currentlyPlayingVO.audioSourceType != AppleAudioSource.AudioSourceType.CriticalVO)
|
||||
{
|
||||
currentlyPlayingVO.InterruptAudio(requestedAudioSource.name);
|
||||
currentlyPlayingVO = requestedAudioSource;
|
||||
Debug.Log($"CurrentVO prio: {currentlyPlayingVO.priority} requested VO prio: {requestedAudioSource.priority}");
|
||||
RegisterStartStopEvents(requestedAudioSource.audioSource);
|
||||
return true;
|
||||
}
|
||||
if (currentlyPlayingVO.audioSourceType == AppleAudioSource.AudioSourceType.CriticalVO && currentlyPlayingVO.priority > requestedAudioSource.priority)
|
||||
{
|
||||
currentlyPlayingVO.InterruptAudio(requestedAudioSource.name);
|
||||
Debug.Log($"CurrentVO prio: {currentlyPlayingVO.priority} requested VO prio: {requestedAudioSource.priority}");
|
||||
currentlyPlayingVO = requestedAudioSource;
|
||||
RegisterStartStopEvents(requestedAudioSource.audioSource);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"CurrentVO prio: {currentlyPlayingVO.priority} requested VO prio: {requestedAudioSource.priority}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnApplicationQuit()
|
||||
{
|
||||
// TODO: Release the handles safely ReleaseAllHandles();
|
||||
}
|
||||
|
||||
private void RegisterStartStopEvents(AudioSource audioSource)
|
||||
{
|
||||
if (audioSource.resource == null)
|
||||
{
|
||||
Debug.Log($"AppleAudioSource {audioSource.name} could not register Start and Stop events.");
|
||||
}
|
||||
else
|
||||
{
|
||||
_eventSource = audioSource.RequestEventHandlers();
|
||||
_eventSource.AudioStopped += OnAudioStopped;
|
||||
_eventSource.AudioStarted += OnAudioStarted;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAudioStopped(object sender, EventArgs e)
|
||||
{
|
||||
currentlyPlayingVO = null;
|
||||
_eventSource.AudioStopped -= OnAudioStopped;
|
||||
_eventSource.AudioStarted -= OnAudioStarted;
|
||||
|
||||
}
|
||||
|
||||
private void OnAudioStarted(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,10 +41,11 @@ public class BushAudioController : MonoBehaviour
|
||||
|
||||
private void PlayBirdCounter(object sender, EventArgs e)
|
||||
{
|
||||
_eventSource.AudioStopped -= PlayBirdCounter;
|
||||
VOPlayer.resource = birdCounterClip[birdGameStats.birdsFoundInLevel];
|
||||
VOPlayer.Play();
|
||||
birdGameStats.BirdFound();
|
||||
_eventSource.AudioStopped -= PlayBirdCounter;
|
||||
|
||||
}
|
||||
|
||||
public void OnDisable()
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
using System;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class NarratorVO : MonoBehaviour
|
||||
public class LevelAudioObject : MonoBehaviour
|
||||
{
|
||||
public AudioSource narratorAudioSource;
|
||||
public AppleAudioSource narratorAudioSource;
|
||||
public AudioResource firstNarration;
|
||||
public UnityEvent narrationFinished;
|
||||
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
@@ -18,14 +15,8 @@ public class NarratorVO : MonoBehaviour
|
||||
|
||||
void PlayNarrationAudio()
|
||||
{
|
||||
|
||||
narratorAudioSource.resource = firstNarration;
|
||||
narratorAudioSource.audioSource.resource = firstNarration;
|
||||
narratorAudioSource.Play();
|
||||
}
|
||||
|
||||
private void NarrationFinished(object sender, EventArgs e)
|
||||
{
|
||||
narrationFinished.Invoke();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,7 +9,8 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1817619063130555080}
|
||||
- component: {fileID: 2652043308892028149}
|
||||
- component: {fileID: 7011897926976640219}
|
||||
- component: {fileID: 2868668640744225356}
|
||||
m_Layer: 0
|
||||
m_Name: LakeAmbience
|
||||
m_TagString: Untagged
|
||||
@@ -32,7 +33,7 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2873907538289469479}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!82 &2652043308892028149
|
||||
--- !u!82 &7011897926976640219
|
||||
AudioSource:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@@ -129,6 +130,21 @@ AudioSource:
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
--- !u!114 &2868668640744225356
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1142003717250661430}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 242e6101be071f44fb14c3c12641c833, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: AppleHillsScripts::AppleAudioSource
|
||||
audioSourceType: 2
|
||||
audioSource: {fileID: 0}
|
||||
priority: 0
|
||||
--- !u!1 &5928208945904495084
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -138,7 +154,8 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4121215864022656322}
|
||||
- component: {fileID: 4192226596753188864}
|
||||
- component: {fileID: 4697053756786608239}
|
||||
- component: {fileID: 3633366175640516686}
|
||||
m_Layer: 0
|
||||
m_Name: AmbiencePlayer
|
||||
m_TagString: Untagged
|
||||
@@ -161,7 +178,7 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2873907538289469479}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!82 &4192226596753188864
|
||||
--- !u!82 &4697053756786608239
|
||||
AudioSource:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@@ -258,6 +275,21 @@ AudioSource:
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
--- !u!114 &3633366175640516686
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5928208945904495084}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 242e6101be071f44fb14c3c12641c833, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: AppleHillsScripts::AppleAudioSource
|
||||
audioSourceType: 2
|
||||
audioSource: {fileID: 0}
|
||||
priority: 0
|
||||
--- !u!1 &6199677512542707633
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -268,7 +300,6 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 2873907538289469479}
|
||||
- component: {fileID: 8545106365577783398}
|
||||
- component: {fileID: 7585931024614860467}
|
||||
m_Layer: 0
|
||||
m_Name: QuarryAudio
|
||||
m_TagString: Untagged
|
||||
@@ -306,24 +337,57 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: cb5c6632b7606ce43a0b2dbf11215dc8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: '::'
|
||||
narratorAudioSource: {fileID: 9091997474527205907}
|
||||
narratorAudioSource: {fileID: 4188190597242138317}
|
||||
firstNarration: {fileID: 8300000, guid: d0a13dd948bacda48be267eec3e0b080, type: 3}
|
||||
narrationFinished:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!82 &7585931024614860467
|
||||
--- !u!1 &6350035581257276269
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2279651898552875333}
|
||||
- component: {fileID: 7536581660526894160}
|
||||
- component: {fileID: 4188190597242138317}
|
||||
m_Layer: 0
|
||||
m_Name: Narrator1
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2279651898552875333
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6350035581257276269}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -21.218311, y: -13.261439, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2873907538289469479}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!82 &7536581660526894160
|
||||
AudioSource:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6199677512542707633}
|
||||
m_GameObject: {fileID: 6350035581257276269}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 4
|
||||
OutputAudioMixerGroup: {fileID: 0}
|
||||
OutputAudioMixerGroup: {fileID: -281949353495416486, guid: 727a7e4b6df4b0d47897f7d8ee7fa323, type: 2}
|
||||
m_audioClip: {fileID: 0}
|
||||
m_Resource: {fileID: 0}
|
||||
m_PlayOnAwake: 1
|
||||
m_PlayOnAwake: 0
|
||||
m_Volume: 1
|
||||
m_Pitch: 1
|
||||
Loop: 0
|
||||
@@ -408,132 +472,18 @@ AudioSource:
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
--- !u!1 &6350035581257276269
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2279651898552875333}
|
||||
- component: {fileID: 9091997474527205907}
|
||||
m_Layer: 0
|
||||
m_Name: Narrator1
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2279651898552875333
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6350035581257276269}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -21.218311, y: -13.261439, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2873907538289469479}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!82 &9091997474527205907
|
||||
AudioSource:
|
||||
--- !u!114 &4188190597242138317
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6350035581257276269}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 4
|
||||
OutputAudioMixerGroup: {fileID: -281949353495416486, guid: 727a7e4b6df4b0d47897f7d8ee7fa323, type: 2}
|
||||
m_audioClip: {fileID: 0}
|
||||
m_Resource: {fileID: 0}
|
||||
m_PlayOnAwake: 0
|
||||
m_Volume: 1
|
||||
m_Pitch: 1
|
||||
Loop: 0
|
||||
Mute: 0
|
||||
Spatialize: 0
|
||||
SpatializePostEffects: 0
|
||||
Priority: 128
|
||||
DopplerLevel: 1
|
||||
MinDistance: 0
|
||||
MaxDistance: 500
|
||||
Pan2D: 0
|
||||
rolloffMode: 0
|
||||
BypassEffects: 0
|
||||
BypassListenerEffects: 0
|
||||
BypassReverbZones: 0
|
||||
rolloffCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
panLevelCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
spreadCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
reverbZoneMixCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 242e6101be071f44fb14c3c12641c833, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: AppleHillsScripts::AppleAudioSource
|
||||
audioSourceType: 0
|
||||
audioSource: {fileID: 0}
|
||||
priority: 1
|
||||
|
||||
Reference in New Issue
Block a user