void Update() { if (durationToSoundLiftoff < 0.0f) { durationToSoundLiftoff = randomFloat(minDurationToSound, maxDurationToSound); } if (stopWatch.execeedesMilliseconds((int)durationToSoundLiftoff)) { AudioSource liftoffSound = GetComponent <AudioSource>(); liftoffSound.Play(); durationToSoundLiftoff = -1.0f; stopWatch.reset(); } }