void MakeLoopEndSwitch(GunSoundSourceElement element, double switchTime) { element.MakeLoopEndSwitch(switchTime); if (element.isReverb) { element.volume = lastElementVolume * reverbVolume; } else { element.volume = lastElementVolume; } element.priority = _priority; element.maxDistance = _maxDistance; element.outputAudioMixerGroup = _outputAudioMixerGroup; }
void SetSetting(GunSoundSetting setting) { lastSetting = setting; for (int i = 0; i < elements.Length; ++i) { elements[i].Destroy(); } if (setting) { if (setting) { setting.InitCheck(); } var sounds = setting.sounds; elements = new GunSoundSourceElement[sounds.Length]; _maxEndSoundDuration = 0; for (int i = 0; i < sounds.Length; ++i) { elements[i] = new GunSoundSourceElement(setting, sounds[i], this); _maxEndSoundDuration = Mathf.Max(_maxEndSoundDuration, elements[i].maxEndSoundDuration); } } }