AutomaticDockArea
A class in Root.Township, Alta.Inventory.
A trigger area that docks loose pickups dropped into it, first into a dock of the same item type and then into any dock that takes it. Server only; clients turn its colliders off.
- Listed in Items, inventory and logic
- Inherits or implements
MonoBehaviour,IBuildRendererBakeable,IBuildBakeable - Derived types
RejectDockArea - Documented in Items, interaction and damage
Constructors
| Member | What it is |
|---|---|
AutomaticDockArea() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|---|
private Collider[] colliders | The trigger colliders of this area. |
private PickupDock[] docks | Backing field for Docks. |
private static Logger logger | NLog logger for this class. |
private int recheckCount | Counter that sets how often OnTriggerStay retries; starts at a random value so areas don't all recheck together. |
private IUnityUpdateMethod update | The registered budgeted update for UpdateCount. |
Properties
| Member | What it is |
|---|---|
PickupDock[] Docks { get; set; } | The docks pickups are put into, in order of preference. |
1 private and internal property
Methods
| Member | What it is |
|---|---|
protected virtual void HandleReject(Pickup pickup) | Called when no dock would take a pickup. Does nothing here; subclasses can override it. |
9 private and internal methods
| Member | What it is |
|---|---|
private void IBuildRendererBakeable.Bake(bool isSaving) | Build bake hook. Does nothing. |
private void IBuildRendererBakeable.Clean() | Build bake clean hook. Does nothing. |
private void Initialize(NetworkEntity entity) | Once the first dock's entity is ready: the server starts the recheck counter; clients disable the trigger colliders. |
private void OnDisable() | Stops the recheck counter update. |
private void OnTriggerEnter(Collider other) | Server: docks a loose, unheld, non-kinematic pickup into the first matching dock, then any accepting dock, else calls HandleReject. |
private void OnTriggerStay(Collider other) | Retries docking for objects still in the trigger, once every 30 budgeted updates. |
private void OnValidate() | Editor: warns about null docks and, if no colliders are set, fills colliders with the trigger colliders on this object or its rigidbody. |
private void Start() | Removes the component if it has no docks, otherwise initializes once the first dock's entity is ready. |
private void UpdateCount() | Budgeted update that steps recheckCount round from 0 to 29. |
Used in
Members of other types that take, return or hold a AutomaticDockArea: