本文整理汇总了C#中UnityEngine.AudioSource.DOFade方法的典型用法代码示例。如果您正苦于以下问题:C# AudioSource.DOFade方法的具体用法?C# AudioSource.DOFade怎么用?C# AudioSource.DOFade使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.AudioSource
的用法示例。
在下文中一共展示了AudioSource.DOFade方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MusicFade
IEnumerator MusicFade(float fadeOut, float fadeIn, AudioSource musicSource, AudioClip newClip)
{
musicSource.DOFade(0.0f, fadeOut);
yield return new WaitForSeconds(fadeOut);
musicSource.clip = newClip;
musicSource.volume = 0.0f;
musicSource.Play();
musicSource.DOFade(1.0f, fadeIn);
yield return null;
}
示例2: StopSound
IEnumerator StopSound(float time2wait, AudioSource rumble, float fadeTime)
{
yield return new WaitForSeconds(time2wait);
rumble.DOFade(0, fadeTime).SetEase(soundCurve);
yield return new WaitForSeconds(fadeTime);
rumble.Stop();
}
示例3: Awake
protected void Awake() {
instance = this;
// Play baseline music
baselineMusic = this.music[(int)MusicType.MusicBaseline];
baselineMusic.volume = 0f;
baselineMusic.Play();
// Tween volume
baselineMusic
.DOFade(1.0f, 3f)
.SetEase(Ease.InSine);
// Start all sfx in the background so they stay on beat
sounds[(int)SfxType.FxCreeper1].volume = 0;
sounds[(int)SfxType.FxCreeper2].volume = 0;
sounds[(int)SfxType.FxTams1].volume = 0;
sounds[(int)SfxType.FxKickSlow].volume = 0;
sounds[(int)SfxType.FxDistortedHat].volume = 0;
sounds[(int)SfxType.FxWeirdDrummish].volume = 0;
sounds[(int)SfxType.FxKickBassFast].volume = 0;
sounds[(int)SfxType.FxMetal1].volume = 0;
sounds[(int)SfxType.FxMelodicDistorted1].volume = 0;
sounds[(int)SfxType.FxMelodic2].volume = 0;
sounds[(int)SfxType.FxTams2].volume = 0;
sounds[(int)SfxType.FxMelodic1].volume = 0;
sounds[(int)SfxType.FxWubBassSlow].volume = 0;
sounds[(int)SfxType.FxCreeper1].Play();
sounds[(int)SfxType.FxCreeper2].Play();
sounds[(int)SfxType.FxTams1].Play();
sounds[(int)SfxType.FxKickSlow].Play();
sounds[(int)SfxType.FxDistortedHat].Play();
sounds[(int)SfxType.FxWeirdDrummish].Play();
sounds[(int)SfxType.FxKickBassFast].Play();
sounds[(int)SfxType.FxMetal1].Play();
sounds[(int)SfxType.FxMelodicDistorted1].Play();
sounds[(int)SfxType.FxMelodic2].Play();
sounds[(int)SfxType.FxTams2].Play();
sounds[(int)SfxType.FxMelodic1].Play();
sounds[(int)SfxType.FxWubBassSlow].Play();
}
示例4: DOFade
public static Tweener DOFade(AudioSource target, float endValue, float duration, float delay = 0, System.Action doComplete = null)
{
Tweener tweener = target.DOFade(endValue, duration);
SetTweenerComplete(tweener, delay, doComplete);
return tweener;
}