private void CheckElements() { for (int i = 0; i < AudioElement.activeAudioElements.Count; i++) { AudioElement audioElement = AudioElement.activeAudioElements[i]; bool isInside = IsTransformInside(effectArea, audioElement.transform); CheckElement(audioElement, isInside); } }
private void CheckElement(AudioElement audioElement, bool isInside) { if (isInside) { if (!audioElements.Contains(audioElement)) { audioElements.Add(audioElement); audioElement.OnAudioAreaEnter(this); } } else { if (audioElements.Contains(audioElement)) { audioElements.Remove(audioElement); audioElement.OnAudioAreaExit(this); } } }