internal void ProcessSoundEffect(SoundControllerInstance Instance) { if (BlockedAudioSource == null) { Initialize(); } if (Instance.Mode == Assets.Scripts.SoundController.PlayMode.Immediate || Instance.Mode == Assets.Scripts.SoundController.PlayMode.Block) { BlockedAudioSource.PlayOneShot(Instance.Clip); } if (Instance.Mode == Assets.Scripts.SoundController.PlayMode.Block) { BlockTimeInSeconds = Instance.Clip.length; StartCoroutine("BlockAudioSource"); } if (Instance.Mode == Assets.Scripts.SoundController.PlayMode.Wait || Instance.Mode == Assets.Scripts.SoundController.PlayMode.WaitAndBlock) { GetAudioClipBufferLock(); AudioClipBuffer.Add(Instance); ReleaseAudioClipBufferLock(); } }
public void ProcessSoundEffect(Assets.Scripts.SoundController.PlayMode Mode, SoundEffects SoundEffect) { AudioClip clip = SoundEffectManager.GetClip(SoundEffect); if (clip != null) { SoundControllerInstance instance = new SoundControllerInstance(Mode, clip); ProcessSoundEffect(instance); } }
private void PlayOnBlockedAudioSource(SoundControllerInstance Instance) { BlockedAudioSource.clip = Instance.Clip; BlockedAudioSource.Play(); if (Instance.Mode == Assets.Scripts.SoundController.PlayMode.WaitAndBlock) { BlockTimeInSeconds = Instance.Clip.length; StartCoroutine("BlockAudioSource"); } }
// Update is called once per frame void Update() { if (!Blocked) { GetAudioClipBufferLock(); SoundControllerInstance instance = null; if (AudioClipBuffer.Any()) { instance = new SoundControllerInstance(); instance = AudioClipBuffer[0]; AudioClipBuffer.RemoveAt(0); } ReleaseAudioClipBufferLock(); if (instance != null) { PlayOnBlockedAudioSource(instance); } } }