Skip to main content

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.

Constructors​

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

Fields​

14 private and internal fields
MemberWhat it is
private PooledDockVisual activePooledVisualPooled visual in use. Not set anywhere in this build.
private static Dictionary<int, Mesh> coloredMeshesStatic cache of coloured meshes. Not used in this build.
private TextRenderer countLabel3D3D text showing how many items the dock holds.
private int distantBacking field for Distant: frames to skip before this visual is evaluated again, so far docks update less often.
private PickupDock dockBacking field for Dock, the PickupDock in a parent.
private MeshRenderer dockBubbleBacking field for DockBubble, the bubble mesh shown at the dock.
private bool hasNearbyScalerTrue when a NearbyPlayerScaler was found in a parent.
private bool isPulsingTrue while the bubble pulses for a hover.
private NearbyPlayerScaler nearbyScalerScaler in a parent that grows the dock near the player; enabled only while the player is near.
private PooledObjectDefinition pooledDockVisualDefinitionPool definition for dock visuals. Not read in this build.
private ScalePulsator scalePulsatorComponent that pulses the bubble's scale, added by StartPulse.
private static IUnityUpdateMethod updateDistanceStatic handle for the shared UpdateAllDistances late update.
private static HashSet<DockVisual> updatingVisualsStatic set of all client dock visuals that UpdateAllDistances goes through.
private Func<bool> validateCameraHideCheck for whether to hide the bubble in hand camera photos, built in Awake from the screenshot hide setting.

Properties​

MemberWhat 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
MemberWhat it is
private int IBuildRendererBakeable.SortingOrder { get; }Bake order for build-time renderer baking, 10.

Methods​

MemberWhat it is
void BeginNearPlayer()Called when the local player's head comes within range. Turns on the nearby scaler for client docks.
void ClearVisual()Destroys the visual's game object.
void EndNearPlayer()Called when the local player's head leaves range. Turns off the nearby scaler.
void SetIsScaledUp(bool isScaledUp)Hook for when the dock scales up. Its pooling work is empty in this build.
void UpdateQuantityStoredText(int quantityStored, bool isCountHidden)Shows the stored count on the 3D label, or clears it when the count is hidden.
17 private and internal methods
MemberWhat 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: