GoToStoreAction
Agent action that navigates the character to a shop table's display area. Resolves the DisplayArea from the target Table, then moves to its OuterSpot position using a MoveToTargetAction sub-action.
Definition
Namespace: Paragon.Townskeep.AgentSystem
Assembly: Townskeep.dll
public class GoToStoreAction : AgentActionInheritance: Action → AgentAction → GoToStoreAction
Remarks
GoToStoreAction is a high-level navigation action used in agent shopping behavior. It combines shop system knowledge (Table → DisplayArea → OuterSpot) with pathfinding (MoveToTargetAction).
Execution Flow
OnBegin — Creates a new
MoveToTargetActionand resolves theDisplayAreafrom theTableby castingtable.AreatoDisplayAreaOnExecute — Initializes the move action with agent context, sets the target to
displayArea.OuterSpot.position, and awaits movement completion
Table → DisplayArea Relationship
The Table component has an Area property of type TableArea. GoToStoreAction casts this to DisplayArea, which is a TableArea subclass representing a display counter. The OuterSpot is a Transform marking the customer-facing position.
Quick Lookup
Assign the target table
Set the table variable via Inspector or action.SetVariable("table", shopTable)
Navigate to the store
await goToStoreAction.ExecuteAsync()
Fields
table
Table
[Variable] private
The shop table to navigate to
Extension Points
This is a concrete (non-abstract) action. Override lifecycle hooks from Action if subclassing:
OnBegin()
Creates MoveToTargetAction and resolves DisplayArea from the table
OnExecute()
Initializes the move action and navigates to the outer spot
Common Pitfalls
Table variable must be set before execution
The table field is marked [Variable] but has no default value. If null when OnBegin() runs, table.Area will throw a NullReferenceException.
Assumes Table.Area is a DisplayArea
OnBegin() casts table.Area to DisplayArea without a type check. If the table uses a different TableArea subclass, an InvalidCastException will occur.
MoveToTargetAction is initialized in OnExecute, not OnBegin
Unlike FollowPathAction, this action creates the MoveToTargetAction in OnBegin() but calls Initialize() on it in OnExecute(). This is because the agent context is needed, but the pattern is inconsistent with other agent actions — be aware when copying this pattern.
Navigates to OuterSpot only
This action moves the agent to the customer-facing position (OuterSpot). It does not perform any interaction with the table or its items. Shopping behavior requires additional actions (e.g., GrabItemAction, TradeItemAction) in the sequence.
Examples
In an ActionSequence (Inspector)
A typical shopping behavior sequence:
Programmatic Usage
See Also
AgentAction — abstract base with agent context
FollowPathAction — another concrete agent action
Agent — the AI brain that executes action sequences
Actions Overview — subsystem architecture
Last updated