A class in Root.Township, the global namespace.
Saved, non-networked drawbridge that rotates its transform around local Z by a set angle over time each time it is toggled.
Constructors
| Member | What it is |
|---|
DrawBridgeLogic() | Creates a DrawBridgeLogic with default values. |
Fields
| Member | What it is |
|---|
bool isUp | Whether the bridge is up; flipped after each move. |
6 private and internal fields
| Member | What it is |
|---|
private float angleToRotate | Degrees to turn on the next toggle; negated after each move. |
private bool isMoving | True while a rotation is running. |
private Quaternion rotationEnd | Target rotation of the current move. |
private Quaternion rotationStart | Starting rotation of the current move. |
private float rotationTime | Seconds each move takes. |
private Vector3 z | Unit Z vector set in Awake, not otherwise used. |
Methods
| Member | What it is |
|---|
void ToggleRotate() | Starts rotating by angleToRotate unless already moving. |
2 private and internal methods
| Member | What it is |
|---|
private void Awake() | Sets up the Z axis vector and clears the moving flag. |
private IEnumerator RotateOverTime(Quaternion start, Quaternion end, float rotTime) (iterator) | Coroutine that slerps the local rotation, then flips isUp and negates the angle for the next toggle. |