diff --git a/Assets/Scripts/OCES/Audio/HandWritten/SfxSystem.cs b/Assets/Scripts/OCES/Audio/HandWritten/SfxSystem.cs
index e033cd3..da454af 100644
--- a/Assets/Scripts/OCES/Audio/HandWritten/SfxSystem.cs
+++ b/Assets/Scripts/OCES/Audio/HandWritten/SfxSystem.cs
@@ -212,7 +212,7 @@ namespace OCES.Audio
///
/// 连续容器播放协程(Random / Sequence 持续模式)
///
- IEnumerator PlayContainerContinuous(AudioSource source, AudioObject audioObject, ActiveSound chainActive, int startIndex, float pitch, float volume)
+ IEnumerator PlayContainerContinuous(AudioSource source, AudioObject audioObject, ActiveSound chainActive, int startIndex)
{
bool isRandom = audioObject.ContainerType == ContainerType.Random;
@@ -234,7 +234,7 @@ namespace OCES.Audio
limitRepetition);
// 配置并播放
- if (!SetupSource(source, audioObject, pitch, volume,index))
+ if (!SetupSource(source, chainActive, index))
{
Debug.LogError($"音频文件未找到:{audioObject.Name[index]}");
yield break;
@@ -339,8 +339,9 @@ namespace OCES.Audio
return this.m_sfxGroup;
}
- bool SetupSource(AudioSource source, AudioObject audioObject, float pitch, float volume, int clipIndex = 0)
+ bool SetupSource(AudioSource source, ActiveSound activeSound, int clipIndex = 0)
{
+ AudioObject audioObject = activeSound.AudioObject;
AudioClip clip = Resources.Load($"Audios/{audioObject.Name[clipIndex]}"); // TODO 抽象同一资源加载接口
if (!clip)
{
@@ -352,8 +353,8 @@ namespace OCES.Audio
source.loop = audioObject.LoopCount < 0;
source.priority = audioObject.Priority;
source.outputAudioMixerGroup = GetMixerGroup(audioObject.MixingType);
- source.pitch = pitch;
- source.volume = volume;
+ source.pitch = activeSound.Pitch;
+ source.volume = activeSound.Volume;
return true;
}
@@ -393,10 +394,10 @@ namespace OCES.Audio
AudioObject = audioObject,
Pitch = pitch,
Volume = volume,
- State = ActiveSoundState.Playing
+ State = ActiveSoundState.Playing,
};
- if (!SetupSource(source, audioObject, pitch, volume, i))
+ if (!SetupSource(source, child, i))
{
this.m_pool.ReturnToPool(source.gameObject);
continue;
@@ -432,7 +433,7 @@ namespace OCES.Audio
int start = audioObject.ContainerType == ContainerType.Random ? -1 : 0;
active.Coroutine = StartCoroutine(
- PlayContainerContinuous(sourceSingle, audioObject, active, start, pitch, volume)
+ PlayContainerContinuous(sourceSingle, audioObject, active, start)
);
return;
@@ -448,9 +449,9 @@ namespace OCES.Audio
_ => 0
};
- if (!SetupSource(sourceSingle, audioObject, pitch, volume, index))
+ if (!SetupSource(sourceSingle, active, index))
{
- m_pool.ReturnToPool(sourceSingle.gameObject);
+ this.m_pool.ReturnToPool(sourceSingle.gameObject);
return;
}