when stopping radio sound, save radio station's time only if audio source is playing

This commit is contained in:
in0finite 2020-05-07 23:04:14 +02:00
parent 8e8e495633
commit 1b19e38bc6

View file

@ -131,7 +131,8 @@ namespace SanAndreasUnity.Behaviours.Vehicles
m_isPlayingRadio = false; m_isPlayingRadio = false;
m_isWaitingForNewRadioSound = false; m_isWaitingForNewRadioSound = false;
if (m_currentRadioStationIndex >= 0) // save current station's time
if (m_currentRadioStationIndex >= 0 && m_radioAudioSource.isPlaying)
RadioStation.stations[m_currentRadioStationIndex].currentTime = m_radioAudioSource.time; RadioStation.stations[m_currentRadioStationIndex].currentTime = m_radioAudioSource.time;
m_radioAudioSource.Stop(); m_radioAudioSource.Stop();