Skip to main content

CurveScaler

A class in Root.Township, the global namespace.

Animates an object's scale between off and on using curves, for example a dock hint or a fake cork that grows and shrinks.

Constructors​

MemberWhat it is
CurveScaler()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

MemberWhat it is
protected bool isDisallowingZeroWhether the scale may reach exactly zero. True by default.
protected AnimationCurve offCurve played when turning off.
protected AnimationCurve onCurve played when turning on.
protected Vector3 startScaleThe object's scale when it woke, used as the full-size scale.
3 private and internal fields
MemberWhat it is
private ScaleAnimator animatorCached scale animator; rebuilt if it belongs to another behaviour.
private DockVisual[] dockVisualsDock visuals in children; when present a renderer scale animator is used.
private bool isInitiallyOnWhether the animator starts in the on (scaled up) state.

Properties​

MemberWhat it is
DockVisual[] DockVisuals { get; }Child dock visuals. If any exist, a renderer-based scale animator is used.
bool IsNear { get; }True while the scaler is on.
ScaleAnimator ScaleAnimator { get; }The animator doing the scaling, created on first use.

Events​

MemberWhat it is
event Action<CurveScaler> FinishedAnimationRaised when an animation finishes.

Methods​

MemberWhat it is
void SetValue(bool isOn)Turns the scaler on or off, animating the change.
protected virtual void Awake()Remembers the starting scale.
protected virtual void OnDisable()Stops the animation.

Used in​

Members of other types that take, return or hold a CurveScaler: