DockVisual
A class in Root.Township, Alta.Inventory.
The bubble and item count label on a pickup dock. Switches materials by distance to the local player's head, pulses while hovered, and can hide from the hand camera. Client only; does nothing on a headless server.
- Listed in Items, inventory and logic
- Inherits or implements
MonoBehaviour,IBuildRendererBakeable,IBuildBakeable
Constructors
| Member | What it is |
|---|---|
DockVisual() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
14 private and internal fields
| Member | What it is |
|---|---|
private PooledDockVisual activePooledVisual | Pooled visual in use. Not set anywhere in this build. |
private static Dictionary<int, Mesh> coloredMeshes | Static cache of coloured meshes. Not used in this build. |
private TextRenderer countLabel3D | 3D text showing how many items the dock holds. |
private int distant | Backing field for Distant: frames to skip before this visual is evaluated again, so far docks update less often. |
private PickupDock dock | Backing field for Dock, the PickupDock in a parent. |
private MeshRenderer dockBubble | Backing field for DockBubble, the bubble mesh shown at the dock. |
private bool hasNearbyScaler | True when a NearbyPlayerScaler was found in a parent. |
private bool isPulsing | True while the bubble pulses for a hover. |
private NearbyPlayerScaler nearbyScaler | Scaler in a parent that grows the dock near the player; enabled only while the player is near. |
private PooledObjectDefinition pooledDockVisualDefinition | Pool definition for dock visuals. Not read in this build. |
private ScalePulsator scalePulsator | Component that pulses the bubble's scale, added by StartPulse. |
private static IUnityUpdateMethod updateDistance | Static handle for the shared UpdateAllDistances late update. |
private static HashSet<DockVisual> updatingVisuals | Static set of all client dock visuals that UpdateAllDistances goes through. |
private Func<bool> validateCameraHide | Check for whether to hide the bubble in hand camera photos, built in Awake from the screenshot hide setting. |
Properties
| Member | What it is |
|---|---|
int Distant { get; set; } | Distance bucket used to throttle updates: -1 when near, otherwise frames to skip before the next distance check. |
PickupDock Dock { get; } | The pickup dock this visual belongs to. |
MeshRenderer DockBubble { get; } | The bubble mesh renderer whose material changes with distance. |
bool NeedsToGetFromPool { get; private set; } | Pooled visual flag. Nothing in this build sets it. |
1 private and internal property
Methods
17 private and internal methods
| Member | What it is |
|---|---|
private void Awake() | Client only: hooks the nearby scaler and count label, joins the shared distance update, hooks hover pulsing and the hand camera's screenshot hiding. |
private void IBuildRendererBakeable.Bake(bool isSaving) | Explicit IBuildRendererBakeable implementation. Empty in this build. |
private void IBuildRendererBakeable.Clean() | Explicit IBuildRendererBakeable implementation. Empty in this build. |
private void GetRarityMeshColor(Interactor interactor, Pickup pickup, PickupDock dock) | Tints the bubble with the held pickup's dock colour. Does nothing visible since UpdateMeshColor is empty. |
private void GetsPooledVisual() | Empty in this build; probably once fetched a pooled visual before showing the dock. |
private void ModifyPulse(PickupDock dock, int oldCount) | Starts the bubble pulsing when something hovers over the dock and stops it when nothing does. |
private void OnDestroy() | Client: leaves the distance update set and unhooks the hand camera events. |
private void PostCameraRender(HandCamera handCamera, HandCameraEvent cameraEvent) | Shows the bubble again after a hand camera photo. |
private void PreCameraRender(HandCamera handCamera, HandCameraEvent cameraEvent) | Hides the bubble before a hand camera photo, depending on the screenshot dock hide setting. |
private void ReleaseVisual(NetworkEntity entity, bool isUnload) | Empty in this build. |
private void ResetMeshColor(Interactor interactor, Pickup pickup, PickupDock dock) | Sets the bubble back to the dock's default colour. Does nothing visible since UpdateMeshColor is empty. |
private void SetBubbleEnabled(bool isEnabled) | Turns the bubble renderer on or off when validateCameraHide allows it. |
private void StartPulse() | Adds a ScalePulsator to the bubble on first use, set from the dock's hover settings, and starts it. |
private void StopPulse() | Stops the bubble pulsing. |
private static void UpdateAllDistances() | Static late update: for each dock visual, counts down distant or lets the dock's visual settings evaluate it against the local player's head. |
private void UpdateMeshColor(Color targetColor) | Empty in this build. |
private void UpdateNear(bool isNear) | Shows the count label only while the player is near. |
Used in
Members of other types that take, return or hold a DockVisual: