Skip to main content

AccessibleDocks

A class in Root.Township, Alta.Character.

Accessibility option on the local player's body that moves the belt and back docks up in front of the camera so they are easy to reach. Client only; toggled by holding both quick access buttons or from the quick access menu.

Constructors​

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

Fields​

19 private and internal fields
MemberWhat it is
private bool btnApplyNumbersInspector button that runs ApplyNumbers.
private bool btnDebugInspector button that runs ToggleActive.
private bool btnSetupNumbersInspector button that runs SetupNumbers.
private Transform cameraTransformThe player's camera, which the docks follow while active.
private AccessibleDocks.DockSetup[] docksSetupEach dock with its resting and accessible positions and its number label's rotations.
private bool hasFinishedSetupSet by FinishSetup; toggling does nothing until then.
private bool isActiveBacking field for IsActive.
private bool isLerpingTrue while the docks are still easing towards the camera after turning on.
private Vector3 lastPositionThe dock group's current local position, eased each frame.
private float lerpSpeedHow fast docks move when showing or hiding (default 20).
private static AccessibleDocks localThe local player's instance.
private Vector3 neutralAxisAxis removed from the camera offset, so the docks don't follow the camera along it.
private Vector3 originalPositionThe dock group's resting local position.
private Transform originalTargetParentParent whose space the camera position is measured in.
private PlayerController playerControllerThe local player controller, for reading the quick access buttons.
private Vector3 positionFromCameraOffset from the camera where the docks sit while active.
private IUnityUpdateMethod positionUpdateThe registered per-frame update, PositionUpdate or ReturnToPosition.
private float rotationLerpSpeedHow fast dock number labels rotate when showing or hiding (default 20).
private Transform targetTransformThe transform that holds the docks and is moved.

Properties​

MemberWhat it is
static bool IsActive { get; }True while the local player's accessible docks are out. False if there is no local instance.

Methods​

MemberWhat it is
void FinishSetup()Records each dock's resting position and allows toggling. Called by DockPositionController once docks are placed.
static void ToggleActive()Toggles the local player's accessible docks. Used by the quick access menu action.
10 private and internal methods
MemberWhat it is
private void ApplyNumbers()Editor button: sets each dock number to its accessible rotation.
private void CheckInput(PlayerInput playerInput)When both quick access buttons are held and accessibility is on, shows the docks, or toggles them if the toggle setting is on.
private void IInitializeAsLocalPlayer.InitializeAsLocalPlayer(PlayerController playerController)Makes this the local instance and hooks both controllers' quick access action.
private void OnDestroy()Stops the position update and clears the local instance.
private void OnDrawGizmosSelected()Editor: draws where the docks will sit relative to the camera.
private void PositionUpdate()Per-frame update while active: moves the dock group in front of the camera, easing in at first.
private void ReturnToPosition()Per-frame update after turning off: eases the docks back to their resting place, then stops.
private void SetActive(bool isActive)Switches between showing and hiding the docks and registers the matching update. Ignored until setup is finished.
private void SetupNumbers()Editor button: records each number's resting rotation and works out a rotation that faces the camera.
private async void StopInput(PlayerInput playerInput, bool isDisabling)In hold mode, hides the docks half a second after either quick access button is released.

Used in​

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