/// <summary> /// Creates a VolumeFade action for fading in a certain soundObject. /// </summary> /// <param name="soundObject">The soundObject to fade in.</param> /// <param name="time">The fading time.</param> /// <param name="endVolume">The destination volume.</param> public static VolumeFade FadeIn(ISoundObject soundObject, float time, float endVolume) { VolumeFade fade = new VolumeFade(soundObject, 0, endVolume, time, false); soundObject.Volume = 0.0f; soundObject.Play(); return(fade); }
//--------------------------------------------------------------- #endregion //--------------------------------------------------------------- //--------------------------------------------------------------- #region Initialisation //--------------------------------------------------------------- /// <summary> /// Creates a new VolumeFade action object. /// </summary> /// <param name="soundObject">The soundObject to fade.</param> /// <param name="startVolume">The start volume.</param> /// <param name="endVolume">The target volume.</param> /// <param name="time">The fading time.</param> /// <param name="stopSound">Flag that indicates if playing of the soundObject should be stopped at the end.</param> public VolumeFade(ISoundObject soundObject, float startVolume, float endVolume, float time, bool stopSound) : base("VolumeFadeAction") { this.totalTime = time; this.soundObject = soundObject; this.startVolume = startVolume; this.endVolume = endVolume; this.totalTime = time; this.stopSound = stopSound; }
/// <summary> /// Removes a soundobject from the channel. /// </summary> /// <param name="soundObject">SoundObject to remove.</param> public void Remove(ISoundObject soundObject) { soundObjects.Remove(soundObject); }
/// <summary> /// Adds a soundobject to the channel. /// </summary> /// <param name="soundObject">The sound object to add.</param> public void Add(ISoundObject soundObject) { soundObjects.Add(soundObject); }
/// <summary> /// Creates a VolumeFade action for fading out a certain soundObject. /// </summary> /// <param name="soundObject">The soundObject to fade out.</param> /// <param name="time">The fading time.</param> public static VolumeFade FadeOut(ISoundObject soundObject, float time) { VolumeFade fade = new VolumeFade(soundObject, soundObject.Volume, 0, time, true); return(fade); }