Esempio n. 1
0
    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();
        }
    }
Esempio n. 2
0
    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);
        }
    }
Esempio n. 3
0
    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");
        }
    }
Esempio n. 4
0
    // 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);
            }
        }
    }