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
| Member | What it is |
|---|
PickupAgent() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
| Member | What it is |
|---|
private Agent agent | The creature's AI agent. |
private bool isControlled | True while the creature is held or docked. |
private ActionComponent pickedUpActionComponent | Action the agent does while held. If not set, the AI is turned off instead. |
private Pickup pickup | Backing field for Pickup. |
Properties
| Member | What it is |
|---|
Pickup Pickup { get; } | The pickup that lets players grab the creature. |
Events
| Member | What it is |
|---|
event Action Caught | Raised when the creature becomes held or docked. |
event Action<Interactor> Released | Raised with the last interactor when the creature is let go and undocked. |
Methods
4 private and internal methods
| Member | What 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: