static void PlayEvent(SoundEvent e) { if (Time.realtimeSinceStartup > e.lastTimePlay + e.IntervalBetweenReplay) { if (Time.realtimeSinceStartup - e.lastTimePlay < e.IntervalBetweenReplay * 3) { e.countInThisSery++; } else { e.countInThisSery = 0; } e.lastTimePlay = Time.realtimeSinceStartup; if (e.countInThisSery < e.maxInSeries) { AudioClip c = e.GetClip(); if (c != null) { instance.src.PlayOneShot(c, 1f); } } } }