Пример #1
0
    /// <summary>
    /// Destroy a sound that was playing
    /// </summary>
    private void destroySound(PlayingSound s)
    {
        if (s.Source != null)
        {
            s.Source.Stop();
            s.Source.clip = null;
            if (s.DestroyOnFinish)
            {
                if (s.recycle)
                {
                    RecycleAudioObject(s.Source.gameObject);
                }
                s.Source = null;
            }
        }

        //if there is someone interested in know when
        if (s.Finished != null)
        {
            s.Finished();
        }
        s.Finished = null;
    }