Skip to main content

DockPositionController

A class in Root.Township, Alta.Character.

Moves a player character's tool belt and pouch docks in or out from a centre point to suit their body type. PlayerCharacter holds one and calls Setup with the body type's ratios.

Constructors​

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

Fields​

7 private and internal fields
MemberWhat it is
private AccessibleDocks accessibleDocksPrivate: the character's AccessibleDocks, told when positioning is done.
private Transform centerPrivate: the point the dock offsets are measured from.
private bool hasSetupPrivate: whether the original offsets have been recorded.
private Vector3[] pouchDistancesPrivate: original pouch dock offsets from the centre.
private Transform[] pouchDocksPrivate: the pouch belt dock transforms.
private Vector3[] toolDistancesPrivate: original tool dock offsets from the centre.
private Transform[] toolDocksPrivate: the tool belt dock transforms.

Methods​

MemberWhat it is
static DockPositionController Duplicate(DockPositionController original, Transform parent)Makes a copy with new instances of every dock and the centre, parented under the given transform at the same positions.
void Setup(float toolDistanceRatio, float pouchDistanceRatio)Scales tool and pouch dock offsets by the given ratios, recording the original offsets the first time, then finishes AccessibleDocks setup.
3 private and internal methods
MemberWhat it is
private void PositionDocks(float toolDistanceRatio, Vector3[] distances, Transform[] docks, Vector3 centerPosition)Private: places each dock at its original offset from the centre, scaled by the ratio.
private void Setup(Vector3 centerPosition)Scales tool and pouch dock offsets by the given ratios, recording the original offsets the first time, then finishes AccessibleDocks setup.
private void SetupDocks(Transform[] docks, ref Vector3[] distances, Vector3 centerPosition)Private: records each dock's offset from the centre.

Used in​

Members of other types that take, return or hold a DockPositionController: