A class in Root.Township, the global namespace.
A pulley belt in the mechanical power system: a Turnable that wraps the outside of its connected pulleys and flips spin direction for pulleys inside it.
Constructors
| Member | What it is |
|---|
Belt() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
| Member | What it is |
|---|
private List<Turnable> exterior | Connected turnables the belt wraps around the outside of. Set in the editor by EvaluateExterior. |
private float offset | Backing field for Offset. |
private float rotation | Backing field for Rotation. |
private float speedMultiplier | Serialized speed multiplier. Not read anywhere in this class. |
Properties
| Member | What it is |
|---|
float Offset { get; } | Belt offset passed to the exterior calculation. |
float Rotation { get; } | How far the belt has turned so far. |
Events
| Member | What it is |
|---|
event Action Rotated | Raised each frame the belt's rotation changes, probably so visuals can scroll the belt. |
Methods
| Member | What it is |
|---|
override void BranchUpdate(Turnable from, ref float totalTorque, ref float totalMoi, HashSet<Turnable> cluster, ref bool isJammed, bool isFlipped = false) | Flips direction when the update comes from a turnable not on the exterior, then runs the base update. |
protected override void BranchToConnected(ref float totalTorque, ref float totalMoi, HashSet<Turnable> cluster, ref bool isJammed, bool isFlipped) | Passes the torque update to each connected turnable, flipped when that turnable is on the belt's exterior. |
protected override void Rotate() | Advances rotation from the current speed and fires Rotated, when the belt is moving. |
1 private and internal method
| Member | What it is |
|---|
private bool EvaluateExterior() | Editor helper: recalculates which connected pulleys the belt wraps around the outside of. Returns true if that changed. |
Used in
Members of other types that take, return or hold a Belt: