/// <summary>Delays the playing of an SFXLayer in 3D space.</summary> /// <param name="SFX">The SFXLayer to play.</param> /// <param name="Position">The position in 3D space to play the SFXObject at.</param> /// <param name="DelayDuration">Duration of the delay for the SFXLayer.</param> /// <param name="SFXVolume">The volume multiplier applied.</param> /// <param name="SFXPitch">The pitch multiplier applied.</param> /// <param name="Parent">Parent transform to assign to the SFXLayer (Optional).</param> /// <param name="IsGlobalPosition">If the position to play the SFXLayer at is global or local to the parent.</param> /// <returns>The Coroutine for delaying this SFXLayer.</returns> public Coroutine PlaySuspended(SFXLayer SFX, Vector3 Position, float DelayDuration, float SFXVolume, float SFXPitch, Transform Parent = null, bool IsGlobalPosition = true) { SequencedStartJobs.RemoveAll((Coroutine x) => x == null); Coroutine StartJob = StartCoroutine(DelayedPlay(SFX, Position, DelayDuration, SFXVolume, SFXPitch, Parent, IsGlobalPosition)); SequencedStartJobs.Add(StartJob); return(StartJob); }
/// <summary>Delays the playing of an SFXLayer.</summary> /// <param name="SFX">The SFXLayer to play.</param> /// <param name="DelayDuration">Duration of the delay for the SFXLayer.</param> /// <param name="SFXVolume">The volume multiplier applied.</param> /// <param name="SFXPitch">The pitch multiplier applied.</param> /// <returns>The Coroutine for delaying this SFXLayer.</returns> public Coroutine PlaySuspended(SFXLayer SFX, float DelayDuration, float SFXVolume, float SFXPitch) { SequencedStartJobs.RemoveAll((Coroutine x) => x == null); Coroutine StartJob = StartCoroutine(DelayedPlay(SFX, DelayDuration, SFXVolume, SFXPitch)); SequencedStartJobs.Add(StartJob); return(StartJob); }
/// <summary>Plays the SFXLayer after the specified delay in 3D space.</summary> /// <param name="SFX">The SFXLayer to play.</param> /// <param name="DelayDuration">Duration of the delay for the SFXObject.</param> /// <param name="SFXVolume">The volume multiplier applied.</param> /// <param name="SFXPitch">The pitch multiplier applied.</param> private IEnumerator DelayedPlay(SFXLayer SFX, float DelayDuration, float SFXVolume, float SFXPitch) { yield return(new WaitForUnpausedSeconds(DelayDuration)); SFX.Play(0, SFXVolume, SFXPitch); }
/// <summary>Plays the SFXLayer after the specified delay.</summary> /// <param name="SFX">The SFXLayer to play.</param> /// <param name="Position">The position in 3D space to play the SFXLayer at.</param> /// <param name="DelayDuration">Duration of the delay for the SFXObject.</param> /// <param name="SFXVolume">The volume multiplier applied.</param> /// <param name="SFXPitch">The pitch multiplier applied.</param> /// <param name="Parent">Parent transform to assign to the SFXLayer (Optional).</param> /// <param name="IsGlobalPosition">If the position to play the SFXLayer at is global or local to the parent.</param> private IEnumerator DelayedPlay(SFXLayer SFX, Vector3 Position, float DelayDuration, float SFXVolume, float SFXPitch, Transform Parent = null, bool IsGlobalPosition = true) { yield return(new WaitForUnpausedSeconds(DelayDuration)); SFX.Play(Position, 0, SFXVolume, SFXPitch, Parent, IsGlobalPosition); }