private void _Stop() { primaryFader.Set0(); secondaryFader.Set0(); PrimaryAudioSource.Stop(); if ((bool)SecondaryAudioSource) { SecondaryAudioSource.Stop(); } paused = false; primaryAudioSourcePaused = false; secondaryAudioSourcePaused = false; }
private void _PauseAudioSources() { if (PrimaryAudioSource.isPlaying) { primaryAudioSourcePaused = true; PrimaryAudioSource.Pause(); } else { primaryAudioSourcePaused = false; } if ((bool)SecondaryAudioSource && SecondaryAudioSource.isPlaying) { secondaryAudioSourcePaused = true; SecondaryAudioSource.Pause(); } else { secondaryAudioSourcePaused = false; } }
private void _UnpauseNow() { paused = false; if ((bool)SecondaryAudioSource && secondaryAudioSourcePaused) { SecondaryAudioSource.Play(); } if (dspTimeRemainingAtPause > 0.0 && primaryAudioSourcePaused) { var time = AudioSettings.dspTime + dspTimeRemainingAtPause; playStartTimeSystem = AudioController.SystemTime + dspTimeRemainingAtPause; PrimaryAudioSource.PlayScheduled(time); ScheduledPlayingAtDspTime = time; dspTimeRemainingAtPause = -1.0; } else { if (!primaryAudioSourcePaused) { return; } PrimaryAudioSource.Play(); } }