DeckClamp
A class in Root.Township, Alta.Carpentry.
Visual clamp on a chiselling deck that slides along X to the builder, the current block, or its rest position. Both sides, local only.
- Listed in Crafting and making
- Inherits or implements
MonoBehaviour
Constructors
| Member | What it is |
|---|---|
DeckClamp() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
8 private and internal fields
| Member | What it is |
|---|---|
private float baseDistance | The clamp's starting local X, used as its rest position. |
private Transform baseParent | The clamp's original parent, restored when there is no block. |
private Transform blockTransform | Transform the clamp is parented to while holding a block or builder. |
private ChisellingDeck deck | The chiselling deck this clamp belongs to. |
private float distanceFromBlock | X offset from the current block when one is present. |
private float distanceFromBuilder | X offset from the builder when the dock is active. |
private BuilderDock docker | The builder dock whose active state is tracked. |
private float movementSpeed | Slide speed in units per second. |
Methods
5 private and internal methods
| Member | What it is |
|---|---|
private void Awake() | Remembers the rest position and parent and subscribes to the deck's block change and the dock's active change. |
private IEnumerator Movement(float target) (iterator) | Coroutine that moves the clamp along local X towards the target at movementSpeed. |
private void UpdateBlock(TimberBlock block) | Deck block change handler; repositions the clamp. |
private void UpdateBuilder(bool isActive) | Builder dock active change handler; repositions the clamp. |
private void UpdatePosition(bool isDockerActive) | Picks the target (builder, current block or rest) and starts the move. |