示例#1
0
    public AudioManager.AudioPlayer ObtainPlayer(AudioInfo info)
    {
        if (this.m_sourcePool != null)
        {
            AudioManager.AudioPlayer sourcePool = this.m_sourcePool;
            this.m_sourcePool       = sourcePool.m_nextPlayer;
            sourcePool.m_nextPlayer = null;
            sourcePool.m_info       = info;
            sourcePool.m_source.gameObject.SetActive(true);
            sourcePool.m_source.clip = info.ObtainClip();
            return(sourcePool);
        }
        if (this.m_sourcePoolRoot == null)
        {
            this.m_sourcePoolRoot = AudioManager.GetSourcePoolRoot();
        }
        GameObject gameObject = new GameObject("Audio Source");

        gameObject.transform.parent = this.m_sourcePoolRoot;
        return(new AudioManager.AudioPlayer {
            m_source = gameObject.AddComponent <AudioSource>(),
            m_transform = gameObject.transform,
            m_info = info,
            m_source =
            {
                playOnAwake = false,
                clip        = info.ObtainClip()
            }
        });
    }