예제 #1
0
 /// <summary>
 /// Plays the given <see cref="DeAudioClipData"/> on the stored group,
 /// with the stored volume, pitch and loop settings (unless set otherwise).
 /// A <see cref="DeAudioGroup"/> with the given ID must exist in order for the sound to actually play.
 /// <para>Returns the <see cref="DeAudioSource"/> instance used to play, or NULL if the clip couldn't be played</para>
 /// </summary>
 public static DeAudioSource Play(DeAudioClipData clipData, float?volume = null, float?pitch = null, bool?loop = null)
 {
     return(PlayFrom(clipData, 0,
                     volume == null ? clipData.volume : (float)volume,
                     pitch == null ? clipData.pitch : (float)pitch,
                     loop == null ? clipData.loop : (bool)loop
                     ));
 }
        /// <summary>
        /// Plays the given sound with the stored volume, pitch and loop settings (unless set otherwise).
        /// <para>Returns the <see cref="DeAudioSource"/> instance used to play, or NULL if the clip couldn't be played</para>
        /// </summary>
        public DeAudioSource PlayFrom(DeAudioClipData clipData, float fromTime, float?volume = null, float?pitch = null, bool?loop = null)
        {
            DeAudioSource src = PlayFrom(clipData.clip, fromTime,
                                         volume == null ? clipData.volume : (float)volume,
                                         pitch == null ? clipData.pitch : (float)pitch,
                                         loop == null ? clipData.loop : (bool)loop
                                         );

            return(src);
        }
 /// <summary>
 /// Fades out then stops all sources in this group, while starting the given <see cref="DeAudioClipData"/> with a fade-in effect.
 /// <para>Returns the <see cref="DeAudioSource"/> instance used to play, or NULL if the clip couldn't be played</para>
 /// </summary>
 public DeAudioSource Crossfade(DeAudioClipData clipData, float fadeDuration = 1.5f, bool ignoreTimeScale = true, FadeBehaviour onfadeOutBehaviour = FadeBehaviour.Stop, TweenCallback onComplete = null)
 {
     return(Crossfade(clipData.clip, clipData.volume, clipData.pitch, clipData.loop, fadeDuration, ignoreTimeScale, onfadeOutBehaviour, onComplete));
 }
 /// <summary>
 /// Play the given clip with the stored volume, pitch and loop settings.
 /// Calling Play directly from a DeAudioSource overrides any lock that might've been set
 /// (though the locked status won't change)
 /// </summary>
 public void PlayFrom(DeAudioClipData clipData, float fromTime)
 {
     PlayFrom(clipData.clip, fromTime, clipData.volume, clipData.pitch, clipData.loop);
 }
 /// <summary>
 /// Play the given clip with the stored volume, pitch and loop settings.
 /// Calling Play directly from a DeAudioSource overrides any lock that might've been set
 /// (though the locked status won't change)
 /// </summary>
 public void Play(DeAudioClipData clipData)
 {
     PlayFrom(clipData.clip, 0, clipData.volume, clipData.pitch, clipData.loop);
 }
예제 #6
0
 /// <summary>Starts playing the given <see cref="DeAudioClipData"/> with a fade-in volume effect</summary>
 public static void FadeIn(DeAudioClipData clipData, float duration = 1.5f, bool ignoreTimeScale = true, TweenCallback onComplete = null)
 {
     Play(clipData.groupId, clipData.clip, clipData.volume, clipData.pitch, clipData.loop).FadeFrom(0, duration, ignoreTimeScale, onComplete);
 }