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
| Member | What it is |
|---|
CurveScaler() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|
protected bool isDisallowingZero | Whether the scale may reach exactly zero. True by default. |
protected AnimationCurve off | Curve played when turning off. |
protected AnimationCurve on | Curve played when turning on. |
protected Vector3 startScale | The object's scale when it woke, used as the full-size scale. |
3 private and internal fields
| Member | What it is |
|---|
private ScaleAnimator animator | Cached scale animator; rebuilt if it belongs to another behaviour. |
private DockVisual[] dockVisuals | Dock visuals in children; when present a renderer scale animator is used. |
private bool isInitiallyOn | Whether the animator starts in the on (scaled up) state. |
Properties
| Member | What 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
| Member | What it is |
|---|
event Action<CurveScaler> FinishedAnimation | Raised when an animation finishes. |
Methods
| Member | What 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: