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.

circle-info

InteractionTable implements IEnumerable<InteractionContext>, so it can be iterated with foreach or LINQ directly.

Quick Lookup

Goal
How

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.

circle-exclamation

GetAvailableInteractionsInContext

Returns all InteractionContext entries whose conditions evaluate to true for the given interactable/interactor pair.

Parameter
Type
Description

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

Last updated