namespace Watermelon { /// /// Intermediate generic base for tweens that animate a single typed value on a target object. /// Concrete subclasses (e.g. TransformTweenCases.Position, GraphicTweenCases.Fade) inherit from this /// to get strongly-typed , , and fields /// without repeating the constructor boilerplate. /// /// Implementing a concrete case: /// /// Inherit from TweenCaseFunction<TBaseObject, TValue>. /// In the constructor, store the initial value in (read it from the target). /// Implement to interpolate from to using Interpolate(state). /// Implement to snap directly to . /// Implement to return false when is destroyed. /// /// /// /// Type of the Unity object being animated (e.g. Transform, SpriteRenderer). /// Type of the value being interpolated (e.g. Vector3, Color, float). public abstract class TweenCaseFunction : TweenCase { /// The target Unity object being animated. public TBaseObject tweenObject; /// The value at which the animation begins. Typically captured from in the constructor. public TValue startValue; /// The target value the animation moves towards. public TValue resultValue; /// /// Stores the target object and result value. Concrete subclasses should read the current /// value from and assign it to in their own constructor. /// public TweenCaseFunction(TBaseObject tweenObject, TValue resultValue) { this.tweenObject = tweenObject; this.resultValue = resultValue; } } }