void PushState() { ReverseAudioSourceState rass = new ReverseAudioSourceState(); sample = audioSource.timeSamples; rass.sample = sample; rass.timerSecondsLeft = timer.SecondsLeft; states.Add(rass); }
void PopState() { int lastIndex = states.Count - 1; if (lastIndex > -1) { ReverseAudioSourceState prevState = states[lastIndex]; states.RemoveAt(lastIndex); sample = prevState.sample; timer.Duration = prevState.timerSecondsLeft; } else { Destroy(gameObject); } }