PickupDockingChecker
A class in Root.Township, the global namespace.
Tracks which dock a held pickup is hovering over, fires hover events, plays haptics and auto docks. Each Pickup creates one; it runs while a local player holds it.
- Listed in Global namespace: P
Constructors
| Member | What it is |
|---|---|
PickupDockingChecker(Pickup pickup) | Creates a PickupDockingChecker from pickup. |
Fields
6 private and internal fields
| Member | What it is |
|---|---|
private static HashSet<PickupDock> checkedDocks | Shared scratch set so each dock is only checked once per search. |
private AltaCoroutine currentCheckingCoroutine | The running hover coroutine. |
private Interactor interactorOverDock | The interactor that is over the current dock. |
private float lastUndockTime | Time left on the cooldown after undocking, in seconds. |
private PickupDock overDock | Backing field for DockCandidate. |
private Pickup pickup | The pickup being checked. |
Properties
| Member | What it is |
|---|---|
PickupDock DockCandidate { get; } | The dock the pickup is currently hovering over, or null. |
Events
| Member | What it is |
|---|---|
event PickupDockInteractionHandler HoverOverDockEnded | Fires when the pickup stops hovering over a dock. |
event PickupDockInteractionHandler HoverOverDockStarted | Fires when the pickup starts hovering over a dock. |
Methods
| Member | What it is |
|---|---|
void ClearCurrentDock() | Drops the hovered dock and lowers its hover count. |
void ForceDockCheck() | Runs one hover check straight away. |
void StartCheckingForDock() | Restarts the hover coroutine. Called by Pickup when a local interactor grabs it. |
7 private and internal methods
| Member | What it is |
|---|---|
private void CheckAutoDock(Interactor interactor) | Docks the pickup into the hovered dock if that dock docks automatically, the interactor is local and the undock cooldown is over. |
private IEnumerator CheckHover() (iterator) | Coroutine that updates the hovered dock every frame while the pickup is held, then clears it. |
private int GetClosestDock(out PickupDock closest, out Interactor interactor) | Finds the nearest allowed dock overlapping any of the pickup's interactors. Returns how many allowed docks it found. |
private void OnHoverEnded(Interactor interactor, PickupDock dock) | Raises HoverOverDockEnded. |
private void OnHoverStarted(Interactor interactor, PickupDock dock) | Raises HoverOverDockStarted. |
private void ResetLastUndockedTime(Interactor interactor, Pickup pickup, PickupDock dock) | Starts a 0.1 second cooldown after the pickup is undocked, so it isn't auto docked straight back. |
private void UpdateOverDock() | Works out the closest dock, fires hover start and end events, plays haptics and updates hover counts. |
Used in
Members of other types that take, return or hold a PickupDockingChecker: