Skip to main content

PickupAgent

A class in Root.Township, Alta.Intelligence.

Lets a creature be picked up. Watches the creature's Pickup and, on the server, pauses or changes the AI while it is held or docked. Used by the fire bug.

Constructors​

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

Fields​

4 private and internal fields
MemberWhat it is
private Agent agentThe creature's AI agent.
private bool isControlledTrue while the creature is held or docked.
private ActionComponent pickedUpActionComponentAction the agent does while held. If not set, the AI is turned off instead.
private Pickup pickupBacking field for Pickup.

Properties​

MemberWhat it is
Pickup Pickup { get; }The pickup that lets players grab the creature.

Events​

MemberWhat it is
event Action CaughtRaised when the creature becomes held or docked.
event Action<Interactor> ReleasedRaised with the last interactor when the creature is let go and undocked.

Methods​

4 private and internal methods
MemberWhat it is
private void Awake()Hooks the pickup's interaction and dock events.
private void DockedChanged(Interactor interactor, Pickup arg2, PickupDock arg3)Dock handler that rechecks whether the creature is held.
private void InteractionChanged(Interactable interactable, Interactor interactor)Interaction handler that rechecks whether the creature is held.
private void UpdateControlled(Interactor interactor)When held or docked, server runs the picked-up action (or disables the AI); when released, restarts the AI.

Used in​

Members of other types that take, return or hold a PickupAgent: