Skip to main content

DrawBridgeLogic

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​

MemberWhat it is
DrawBridgeLogic()Creates a DrawBridgeLogic with default values.

Fields​

MemberWhat it is
bool isUpWhether the bridge is up; flipped after each move.
6 private and internal fields
MemberWhat it is
private float angleToRotateDegrees to turn on the next toggle; negated after each move.
private bool isMovingTrue while a rotation is running.
private Quaternion rotationEndTarget rotation of the current move.
private Quaternion rotationStartStarting rotation of the current move.
private float rotationTimeSeconds each move takes.
private Vector3 zUnit Z vector set in Awake, not otherwise used.

Methods​

MemberWhat it is
void ToggleRotate()Starts rotating by angleToRotate unless already moving.
2 private and internal methods
MemberWhat 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.