mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-05-19 10:47:07 +02:00
done (#558)
This commit is contained in:
parent
c2f7e3d071
commit
e532041352
@ -43,6 +43,23 @@ namespace HeavenStudio.Util
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LerpVolume(double beat, double length, float volumeStart, float volumeEnd)
|
||||||
|
{
|
||||||
|
if (!gameObject.activeSelf) return;
|
||||||
|
StartCoroutine(LerpVolumeCo(beat, length, volumeStart, volumeEnd));
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator LerpVolumeCo(double beat, double length, float volumeStart, float volumeEnd)
|
||||||
|
{
|
||||||
|
float normalized = 0;
|
||||||
|
while (normalized <= 1)
|
||||||
|
{
|
||||||
|
normalized = cond.GetPositionFromBeat(beat, length);
|
||||||
|
audioSource.volume = Mathf.Lerp(volumeStart, volumeEnd, normalized);
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Play()
|
public void Play()
|
||||||
{
|
{
|
||||||
if (!available)
|
if (!available)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user