Example #1
0
    // ********************************************************************
    private void StopSound(string _id)
    {
        if (!m_soundMap.ContainsKey(_id))
        {
            Debug.LogWarning("No data found for ID: " + _id);
            return;
        }

        if (!m_activeSounds.ContainsKey(_id))
        {
            // NOTE: No error message as we just want this to be a no-op
            return;
        }

        AudioObject audio = m_activeSounds[_id];

        if (audio != null &&
            audio.gameObject.activeSelf &&
            audio.audioSource.isPlaying &&
            audio.audioClip.name == m_soundMap[_id].clip.name)
        {
            audio.Fade(false);
        }
        m_activeSounds.Remove(_id);
    }