Beispiel #1
0
        private void LoadAudioClip(string name, int type, float volume, Vector3 position, float delay, string extension = "ogg", int priority = 128, bool loop = false, float minPitch = 0f, float maxPitch = 3f)
        {
            string path = this.GetAudioClipPath(name, type);

            if (this.sounds[path] != null)
            {
                SoundManager.AudioData audioData = this.sounds[path];
                if (audioData != null && audioData.audio != null)
                {
                    audioData.audio.volume          = volume;
                    audioData.go.transform.position = position;
                    audioData.Play(delay);
                }
                else
                {
                    this.sounds.RemoveKey(path);
                }
            }
            else
            {
                SoundManager.AudioData data = new SoundManager.AudioData(path, (SoundManager.SoundType)type, loop, this.SoundParent.transform, position, priority, minPitch, maxPitch, volume);
                base.StartCoroutine(Util.LoadAudioClipAsync(data.go, path, extension, delegate(AudioClip clip, string str)
                {
                    if (clip != null)
                    {
                        data.audio.clip   = clip;
                        data.audio.volume = volume;
                        data.Play(delay);
                        this.sounds.Put(path, data, 1);
                    }
                }));
            }
        }