protected void SetPitchScale(float pitch, float time, TweenUtility.Ease ease, bool fromSelf) { if (state == AudioStates.Stopped) { return; } if (fromSelf) { rampPitchTweener.Stop(); if (time > 0f) { rampPitchTweener.Ramp(pitchModifier.RampModifier, pitch, time, setPitchRampModifier, ease, getDeltaTime); } else { pitchModifier.RampModifier = pitch; } } else { rampParentPitchTweener.Stop(); if (time > 0f) { rampParentPitchTweener.Ramp(pitchModifier.ParentModifier, pitch, time, setPitchParentModifier, ease, getDeltaTime); } else { pitchModifier.ParentModifier = pitch; } } }
protected void SetVolumeScale(float volume, float time, TweenUtility.Ease ease, bool fromSelf) { if (state == AudioStates.Stopped) { return; } if (fromSelf) { rampVolumeTweener.Stop(); if (time > 0f) { rampVolumeTweener.Ramp(volumeModifier.RampModifier, volume, time, setVolumeRampModifier, ease, getDeltaTime); } else { volumeModifier.RampModifier = volume; } } else { rampParentVolumeTweener.Stop(); if (time > 0f) { rampParentVolumeTweener.Ramp(volumeModifier.ParentModifier, volume, time, setVolumeParentModifier, ease, getDeltaTime); } else { volumeModifier.ParentModifier = volume; } } }
public static AudioOption PitchScale(float pitch, float time = 0f, TweenUtility.Ease ease = TweenUtility.Ease.Linear, float delay = 0f) { return(Create(Types.PitchScale, new Vector3(pitch, time, (float)ease), delay)); }
public static AudioOption VolumeScale(float volume, float time = 0f, TweenUtility.Ease ease = TweenUtility.Ease.Linear, float delay = 0f) { return(Create(Types.VolumeScale, new Vector3(volume, time, (float)ease), delay)); }
public static AudioOption FadeOut(float fadeOut, TweenUtility.Ease ease = TweenUtility.Ease.InQuad, float delay = 0f) { return(Create(Types.FadeOut, new Vector2(fadeOut, (float)ease), delay)); }
/// <summary> /// Ramps the pitch scale of the AudioItem and its hierarchy. /// Other pitch modifiers such as fades remain unaffected. /// </summary> /// <param name="pitch"> The target pitch at which the AudioItem should be ramped to. </param> /// <param name="time"> The duration of the ramping. </param> /// <param name="ease"> The curve of the interpolation. </param> public void SetPitchScale(float pitch, float time, TweenUtility.Ease ease = TweenUtility.Ease.Linear) { SetPitchScale(pitch, time, ease, false); }
/// <summary> /// Ramps the volume scale of the AudioItem and its hierarchy. /// Other volume modifiers such as fades remain unaffected. /// </summary> /// <param name="volume"> The target volume at which the AudioItem should be ramped to. </param> /// <param name="time"> The duration of the ramping. </param> /// <param name="ease"> The curve of the interpolation. </param> public void SetVolumeScale(float volume, float time, TweenUtility.Ease ease = TweenUtility.Ease.Linear) { SetVolumeScale(volume, time, ease, false); }
public void Ramp(float start, float end, float time, Action <float> setValue, TweenUtility.Ease ease = TweenUtility.Ease.Linear, Func <float> getDeltaTime = null, float delay = 0f, Action startCallback = null, Action endCallback = null) { this.start = start; this.end = end; this.time = time; this.setValue = setValue ?? TweenUtility.EmptyFloatAction; this.easeFunction = TweenUtility.GetEaseFunction(ease); this.getDeltaTime = getDeltaTime ?? (ApplicationUtility.IsPlaying ? TweenUtility.DefaultGetDeltaTime : TweenUtility.DefaultEditorGetDeltaTime); this.delay = delay; this.startCallback = startCallback ?? TweenUtility.EmptyAction; this.endCallback = endCallback ?? TweenUtility.EmptyAction; SetState(TweenStates.Waiting); Update(); }