A class in Root.Township, the global namespace.
Visual only: stretches a rope LineRenderer and moves its end point as a Crank turns. Sits on the crank prefab.
Constructors
| Member | What it is |
|---|
CrankControlledRope() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|
private Crank crank | The Crank whose value drives the rope length. |
private Vector3 direction | Local direction the rope extends in. |
private Transform lineEnd | Transform at the rope's end, moved to the new length each update. |
private AnimationCurve lineLength | Curve from crank value (0 to 1) to rope length; defaults to 0 to 0.3. |
private LineRenderer ropeRenderer | The LineRenderer that draws the rope. |
Methods
2 private and internal methods
| Member | What it is |
|---|
private void Awake() | Subscribes UpdateLineRenderer to the crank's ValueChanged event. |
private void UpdateLineRenderer(Crank crank, float crankValue) | Moves lineEnd and the rope's first point along direction by lineLength evaluated at the crank value. |