56 lines
1.4 KiB
C#
56 lines
1.4 KiB
C#
|
|
using UnityEngine;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
|
|||
|
|
public static class AudioCoreManager
|
|||
|
|
{
|
|||
|
|
private static AudioSourcePool audioSourcePool;
|
|||
|
|
private static VoicePlayer Voice;
|
|||
|
|
private static SFXPlayer SFX;
|
|||
|
|
private static MusicPlayer Music;
|
|||
|
|
|
|||
|
|
// <20><>ʼ<EFBFBD><CABC> AudioCoreManager
|
|||
|
|
static AudioCoreManager()
|
|||
|
|
{
|
|||
|
|
audioSourcePool = new AudioSourcePool();
|
|||
|
|
// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
Voice = new VoicePlayer(audioSourcePool);
|
|||
|
|
SFX = new SFXPlayer(audioSourcePool);
|
|||
|
|
Music = new MusicPlayer(audioSourcePool);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
public static void PlayVoice(AudioClip clip, float volume = 1f, System.Action onComplete = null, float delay = 0f)
|
|||
|
|
{
|
|||
|
|
Voice.Play(clip, volume, onComplete, delay);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD>
|
|||
|
|
public static void StopVoice()
|
|||
|
|
{
|
|||
|
|
Voice.Stop();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч
|
|||
|
|
public static void PlaySFX(AudioClip clip, float volume = 1f, System.Action onComplete = null, float delay = 0f)
|
|||
|
|
{
|
|||
|
|
SFX.Play(clip, volume, onComplete, delay);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч
|
|||
|
|
public static void StopAllSFX()
|
|||
|
|
{
|
|||
|
|
SFX.Stop();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// <20><><EFBFBD>ű<EFBFBD><C5B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
public static void PlayMusic(AudioClip clip, float fadeDuration = 0f)
|
|||
|
|
{
|
|||
|
|
Music.Play(clip, fadeDuration);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
public static void StopMusic(float fadeDuration = 1f)
|
|||
|
|
{
|
|||
|
|
Music.Stop(fadeDuration);
|
|||
|
|
}
|
|||
|
|
}
|