Skip to content

Instantly share code, notes, and snippets.

@flushpot1125
Created November 18, 2017 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flushpot1125/dc19306fae34f0b8c68a9ce3fc54568a to your computer and use it in GitHub Desktop.
Save flushpot1125/dc19306fae34f0b8c68a9ce3fc54568a to your computer and use it in GitHub Desktop.
//Part of the script
/// <summary>
/// Loop for lowering the volume
/// </summary>
private IEnumerator UpdateRoutine()
{
while (true)
{
UpdateVolume();
yield return new WaitForSeconds(_targetTime);
}
}
/// <summary>
/// Lower the volume
/// </summary>
private void UpdateVolume()
{
AudioListener.volume = Mathf.Clamp01(AudioListener.volume + _currentDelta);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment