Reset() public méthode

public Reset ( ) : void
Résultat void
Exemple #1
0
    void Update()
    {
        for (int i = 0; i < toFreeList.Count; ++i)
        {
            AudioChannel channel = toFreeList[i];

            // 回收AudioClip
            Dictionary <string, AudioCache> .Enumerator er = ClipCacheDic.GetEnumerator();
            while (er.MoveNext())
            {
                if (er.Current.Key.Equals(channel.Name))
                {
                    AudioCache cache = er.Current.Value;
                    cache.AddClip(channel.Clip);
                    channel.Reset();
                }
            }

            // 回收AudioChannel
            freeList.Add(channel);
            useList.Remove(channel);

            if (useList.Count + freeList.Count > _maxChannel && freeList.Count > 0)
            {
                GameObject obj = freeList[0].gameObject;
                freeList.RemoveAt(0);
                GameObject.Destroy(obj);
            }
        }

        toFreeList.Clear();
    }
Exemple #2
0
    void Update()
    {
        for (int i = 0; i < mUseList.Count; ++i)
        {
            AudioChannel channel = mUseList[i];
            channel.UpdateChannel();
        }

        for (int i = 0; i < mToFreeList.Count; ++i)
        {
            AudioChannel channel = mToFreeList[i];

            // 回收AudioClip
            Dictionary <string, AudioCache> .Enumerator er = mClipCacheDic.GetEnumerator();
            while (er.MoveNext())
            {
                if (er.Current.Key.Equals(channel.Name))
                {
                    AudioCache cache = er.Current.Value;
                    cache.AddClip(channel.Clip);
                    channel.Reset();
                    break;
                }
            }

            // 回收AudioChannel
            mFreeList.Add(channel);
            mUseList.Remove(channel);

            if (mUseList.Count + mFreeList.Count > mMaxChannel && mFreeList.Count > 0)
            {
                GameObject obj = mFreeList[0].gameObject;
                mFreeList.RemoveAt(0);
                GameObject.Destroy(obj);
            }
        }

        mToFreeList.Clear();

        if (mPlayList.Count != 0)
        {
            AudioChannel channel = mPlayList[0];
            mPlayList.RemoveAt(0);
            channel.Play();
        }
    }