Skip to content

Instantly share code, notes, and snippets.

@gegagome
Last active April 15, 2017 05:53
Show Gist options
  • Select an option

  • Save gegagome/cfa815b43459b6768b86becc3fae7b73 to your computer and use it in GitHub Desktop.

Select an option

Save gegagome/cfa815b43459b6768b86becc3fae7b73 to your computer and use it in GitHub Desktop.
IEnumerator VolumeChange (int stem, float initVol, float endVol, float time) {
float timeElapsed = 0f;
while (_stems[stem].volume != endVol) {
_stems[stem].volume = Mathf.Lerp(initVol, endVol, timeElapsed * 2);
timeElapsed += Time.deltaTime;
Debug.Log("timeElapsed: " + timeElapsed + "\n" + "Time.deltaTime: " + Time.deltaTime + "\n" + "volume: " + _stems[stem].volume);
yield return null;
}
_stems[stem].mute = !_stems[stem].mute;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment