using System; namespace UnityEngine.XR.Interaction.Toolkit.Utilities.Tweenables { /// /// Synchronous implementation of tweenable variable used for types for which it may not be possible to create tween jobs. /// /// BindableVariable type. /// [Obsolete("The Affordance System namespace and all associated classes have been deprecated. The existing affordance system will be moved, replaced and updated with a new interaction feedback system in a future version of XRI.")] public abstract class TweenableVariableSynchronousBase : TweenableVariableBase where T : IEquatable { /// protected override void ExecuteTween(T startValue, T targetValue, float tweenAmount, bool useCurve = false) { if (tweenAmount > k_NearlyOne || IsNearlyEqual(startValue, targetValue)) { Value = targetValue; return; } var adjustedTweenAmount = useCurve ? animationCurve.Evaluate(tweenAmount) : tweenAmount; Value = Lerp(startValue, targetValue, adjustedTweenAmount); } /// /// Function used to interpolate between a tween's start value and target value. /// /// Tween start value. /// Tween target value. /// Value between 0-1 used to evaluate the output between the from and to values. /// Returns the interpolation from to . protected abstract T Lerp(T from, T to, float t); /// /// Evaluates if the value is nearly equal to target. /// /// First value in equality comparison. /// Second value in equality comparison. /// Returns if the values are nearly equal. protected abstract bool IsNearlyEqual(T startValue, T targetValue); } }