A class in Root.Township, the global namespace.
A turnable wheel that adds up how far it has been turned into a running value, checked every LateUpdate. The angle is measured to the world origin in the wheel's local XY plane.
Constructors
| Member | What it is |
|---|
CaptainsWheel() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|
private float currentAngle | Angle from last frame, in degrees. |
private float direction | Sign or scale for the value change. Use -1 to reverse. |
private float lengthPerRevolution | How much the value changes per full turn. |
private float value | Backing field for Value. |
private FloatEvent valueChanged | Serialized event raised with the new value. |
Properties
| Member | What it is |
|---|
float Value { get; } | Running total of turns times lengthPerRevolution. Not clamped. |
Events
| Member | What it is |
|---|
event Action<float, float> ValueChanged | Raised with the old and new value. |
Methods
3 private and internal methods
| Member | What it is |
|---|
private void LateUpdate() | Runs UpdateValues each frame. |
private void OnValueChanged(float newValue) | Stores the new value and raises both the C# and serialized change events. |
private void UpdateValues() | Works out the angle turned since last frame and adds it to the value, scaled by length per revolution and direction. |
Used in
Members of other types that take, return or hold a CaptainsWheel: