A class in Root.Township, the global namespace.
A 2D gear on a Turnable chain that snaps to meshing gears nearby and lines up its teeth with them. Probably an editor or prototype tool.
Constructors
| Member | What it is |
|---|
Gear() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
3 private and internal fields
| Member | What it is |
|---|
private Collider2D[] colliderCheck | Reused buffer for the 2D overlap check. |
private Vector3 oldPosition | Unused. |
private int teeth | Backing field for Teeth. |
Properties
| Member | What it is |
|---|
int Teeth { get; } | Number of teeth, used for the turn ratio. |
Methods
| Member | What it is |
|---|
void AlignWith(Gear other) | Meant to align with another gear; computes a plane intersection but applies nothing. |
void UpdateConnected() | Finds gears touching by radius, connects them and moves and rotates this gear to mesh. |
1 private and internal method
| Member | What it is |
|---|
private void PlanePlaneIntersection(out Vector3 linePoint, out Vector3 lineVec, Transform plane1, Transform plane2) | Line where two transforms' forward planes meet. |