Skip to main content

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.

Constructors​

MemberWhat it is
DeckClamp()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

8 private and internal fields
MemberWhat it is
private float baseDistanceThe clamp's starting local X, used as its rest position.
private Transform baseParentThe clamp's original parent, restored when there is no block.
private Transform blockTransformTransform the clamp is parented to while holding a block or builder.
private ChisellingDeck deckThe chiselling deck this clamp belongs to.
private float distanceFromBlockX offset from the current block when one is present.
private float distanceFromBuilderX offset from the builder when the dock is active.
private BuilderDock dockerThe builder dock whose active state is tracked.
private float movementSpeedSlide speed in units per second.

Methods​

5 private and internal methods
MemberWhat 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.