PickupWeightScale
A class in Root.Township, the global namespace.
A weighing scale: adds up the weight of loose pickups and players standing in its trigger and shows it on a gauge and text.
- Listed in Global namespace: P
- Inherits or implements
MonoBehaviour
Constructors
| Member | What it is |
|---|---|
PickupWeightScale() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
7 private and internal fields
| Member | What it is |
|---|---|
private HashSet<Pickup> containedPickups | Pickups in the trigger. |
private GaugeProgressBar gaugeProgressBar | Gauge that shows the weight. |
private float maxWeight | Weight that maps to the max notch on the gauge. |
private float maxWeightNotchPosition | Gauge fill (0 to 1) of the max weight notch. |
private float minWeight | Unused minimum weight setting. |
private HashSet<PlayerWeight> players | Players standing in the trigger. |
private TextRenderer text | Optional text showing the total weight. |
Methods
7 private and internal methods
| Member | What it is |
|---|---|
private void Docked(Interactor arg1, Pickup pickup, PickupDock arg3) | Stops counting a pickup once it docks somewhere, and refreshes. |
private void DockEventWeightUpdate(Interactor interactor, Pickup pickup, PickupDock dock) | Refreshes the reading when something docks into or leaves a pickup on the scale. |
private void Grabbed(Interactable pickup, Interactor interactor) | Refreshes the reading when a pickup on the scale is grabbed or let go. |
private void OnTriggerEnter(Collider other) | Starts tracking a pickup (not a crafted child) or player that enters, and hooks its events. |
private void OnTriggerExit(Collider other) | Stops tracking a pickup or player that leaves, and unhooks its events. |
private void UpdateWeightDisplay() | Queues a reading update for later in the frame. |
private void UpdateWeightDisplayInternal() | Sums the weight of tracked pickups that aren't held or docked, plus players, and updates the gauge and text. |