public void PlayClip(AudioClip clip, Vector3 point, AudioSource template, float volume, float pitch)
        {
            int checkedIndices = 0;
            int i = lastAvailable;

            while (checkedIndices < TempAudioPoolSize)
            {
                PhysSoundTempAudio a = audioSources[i];

                if (!a.gameObject.activeInHierarchy)
                {
                    a.PlayClip(clip, point, template, volume, pitch);

                    lastAvailable = i;
                    return;
                }

                i++;
                checkedIndices++;

                if (i >= TempAudioPoolSize)
                {
                    i = 0;
                }
            }
        }
        public AudioSource GetSource(AudioSource template)
        {
            int checkedIndices = 0;
            int i = lastAvailable;

            while (checkedIndices < TempAudioPoolSize)
            {
                PhysSoundTempAudio a = audioSources[i];

                if (!a.gameObject.activeInHierarchy)
                {
                    CopyAudioSource(template, a.Audio);
                    a.gameObject.SetActive(true);
                    lastAvailable = i;
                    return(a.Audio);
                }

                i++;
                checkedIndices++;

                if (i >= TempAudioPoolSize)
                {
                    i = 0;
                }
            }

            return(null);
        }
Пример #3
0
 // Token: 0x06003FF9 RID: 16377 RVA: 0x00141C44 File Offset: 0x00140044
 public void Initialize()
 {
     PhysSoundTempAudioPool.Instance = this;
     this.audioSources = new PhysSoundTempAudio[PhysSoundTempAudioPool.TempAudioPoolSize];
     for (int i = 0; i < PhysSoundTempAudioPool.TempAudioPoolSize; i++)
     {
         GameObject         gameObject         = new GameObject("Temp Audio Source");
         PhysSoundTempAudio physSoundTempAudio = gameObject.AddComponent <PhysSoundTempAudio>();
         physSoundTempAudio.Initialize(this);
         this.audioSources[i] = physSoundTempAudio;
     }
 }
        public void Initialize()
        {
            Instance = this;

            audioSources = new PhysSoundTempAudio[TempAudioPoolSize];

            for (int i = 0; i < TempAudioPoolSize; i++)
            {
                GameObject         g = new GameObject("Temp Audio Source");
                PhysSoundTempAudio a = g.AddComponent <PhysSoundTempAudio>();
                a.Initialize(this);

                audioSources[i] = a;
            }
        }
Пример #5
0
        // Token: 0x06003FFA RID: 16378 RVA: 0x00141CA0 File Offset: 0x001400A0
        public void PlayClip(AudioClip clip, Vector3 point, AudioSource template, float volume, float pitch)
        {
            int i   = 0;
            int num = this.lastAvailable;

            while (i < PhysSoundTempAudioPool.TempAudioPoolSize)
            {
                PhysSoundTempAudio physSoundTempAudio = this.audioSources[num];
                if (!physSoundTempAudio.gameObject.activeInHierarchy)
                {
                    physSoundTempAudio.PlayClip(clip, point, template, volume, pitch);
                    this.lastAvailable = num;
                    return;
                }
                num++;
                i++;
                if (num >= PhysSoundTempAudioPool.TempAudioPoolSize)
                {
                    num = 0;
                }
            }
        }