A class in Root.Township, the global namespace.
Turns a wheel's rotation into a saved 0 to 1 progress value. Runs every frame on both sides; progress, rate and direction are saved.
Constructors
| Member | What it is |
|---|
WheelGrab() | Creates a WheelGrab with default values. |
Fields
5 private and internal fields
| Member | What it is |
|---|
private float currentAngle | Wheel angle last frame, in degrees, used to measure the change. |
private float direction | Multiplier on the progress change; a negative value makes the opposite turn add progress. Saved. |
private float progress | Backing field for Progress. |
private FloatEvent progressChanged | Serialized event fired with the new progress, and on load. |
private float progressPerRevolution | Progress gained per full turn. Saved. |
Properties
| Member | What it is |
|---|
float Progress { get; } | Current progress from 0 to 1. Saved. |
Events
| Member | What it is |
|---|
event Action<float, float> ProgressChanged | Raised with the old and new progress when it changes. |
Methods
| Member | What it is |
|---|
void SetProgress(float newValue) | Sets progress and fires both ProgressChanged and the serialized progressChanged event. |
2 private and internal methods
| Member | What it is |
|---|
private void LateUpdate() | Calls UpdateProgress every frame. |
private void UpdateProgress() | Measures how far the wheel turned since last frame and adds it to progress, clamped to 0 to 1. |
Used in
Members of other types that take, return or hold a WheelGrab: