InteractionTable
Serializable collection of InteractionContext entries that defines which interactions are available on an Interactable. Acts as a lookup table, filtering contexts by their conditions to determine what an Interactor can do.
Definition
Namespace: Paragon.Townskeep.InteractionSystem Assembly: Townskeep.dll
[Serializable]
public class InteractionTable : IEnumerable<InteractionContext>Implements: IEnumerable<InteractionContext>
Remarks
InteractionTable is the central data structure on an Interactable. Each entry is an InteractionContext that pairs an Interaction with its triggers and conditions.
The table is configured in the Inspector via Odin serialization and initialized at Awake() (or when set via Interactable.SetInteractionTable()). Initialization cascades to all contained contexts, which in turn initialize their triggers, conditions, and interaction instances.
InteractionTable implements IEnumerable<InteractionContext>, so it can be iterated with foreach or LINQ directly.
Quick Lookup
Get available interactions
table.GetAvailableInteractionsInContext(interactable, interactor)
Initialize all contexts
table.Initialize()
Iterate all contexts
foreach (var ctx in table) { ... }
Methods
Initialize
Initializes all InteractionContext entries in the table. Must be called before querying.
Called automatically by Interactable.Awake() and Interactable.SetInteractionTable(). Do not call manually unless constructing tables outside of Interactable.
GetAvailableInteractionsInContext
Returns all InteractionContext entries whose conditions evaluate to true for the given interactable/interactor pair.
interactable
Interactable
The target interactable
interactor
Interactor
The entity attempting to interact
Returns: Filtered enumerable of contexts that pass condition evaluation.
GetEnumerator
Returns an enumerator over all InteractionContext entries.
See Also
Interactable — component that owns the table
Interactor — entity that queries the table
Interaction — the actions contained in each context
Last updated