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.
- Listed in Players and characters
- Inherits or implements
MonoBehaviour,IInitializeAsLocalPlayer - Nested types
DockSetup - Documented in Player inventory
Constructors
| Member | What it is |
|---|---|
AccessibleDocks() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
19 private and internal fields
| Member | What it is |
|---|---|
private bool btnApplyNumbers | Inspector button that runs ApplyNumbers. |
private bool btnDebug | Inspector button that runs ToggleActive. |
private bool btnSetupNumbers | Inspector button that runs SetupNumbers. |
private Transform cameraTransform | The player's camera, which the docks follow while active. |
private AccessibleDocks.DockSetup[] docksSetup | Each dock with its resting and accessible positions and its number label's rotations. |
private bool hasFinishedSetup | Set by FinishSetup; toggling does nothing until then. |
private bool isActive | Backing field for IsActive. |
private bool isLerping | True while the docks are still easing towards the camera after turning on. |
private Vector3 lastPosition | The dock group's current local position, eased each frame. |
private float lerpSpeed | How fast docks move when showing or hiding (default 20). |
private static AccessibleDocks local | The local player's instance. |
private Vector3 neutralAxis | Axis removed from the camera offset, so the docks don't follow the camera along it. |
private Vector3 originalPosition | The dock group's resting local position. |
private Transform originalTargetParent | Parent whose space the camera position is measured in. |
private PlayerController playerController | The local player controller, for reading the quick access buttons. |
private Vector3 positionFromCamera | Offset from the camera where the docks sit while active. |
private IUnityUpdateMethod positionUpdate | The registered per-frame update, PositionUpdate or ReturnToPosition. |
private float rotationLerpSpeed | How fast dock number labels rotate when showing or hiding (default 20). |
private Transform targetTransform | The transform that holds the docks and is moved. |
Properties
| Member | What it is |
|---|---|
static bool IsActive { get; } | True while the local player's accessible docks are out. False if there is no local instance. |
Methods
| Member | What 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
| Member | What 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: