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;
    }
 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
0
 protected override Tween DOPlay()
 {
     if (null == m_AudioSource)
     {
         return(null);
     }
     // end if
     return(m_AudioSource.DOFade(m_toVolume, m_duration));
 }
示例#4
0
 static int DOFade(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject(L, 1, typeof(UnityEngine.AudioSource));
         float arg0            = (float)LuaDLL.luaL_checknumber(L, 2);
         float arg1            = (float)LuaDLL.luaL_checknumber(L, 3);
         DG.Tweening.Tweener o = obj.DOFade(arg0, arg1);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#5
0
    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();
    }
示例#6
0
 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;
 }