Table

Root MonoBehaviour for a shop surface. Coordinates an Interactable, a TableNetwork, and a TableArea to provide item availability queries and interactable shop behavior. Serves as the entry point for game code to query which items are on the table and available for trade.

Definition

Namespace: Paragon.Townskeep.ShopSystem Assembly: Townskeep.dll

public class Table : MonoBehaviour

Inherits: MonoBehaviour

Remarks

Table is a thin coordination layer. It discovers its child components in Awake():

  • Interactable — on the same GameObject, provides interaction system integration

  • TableNetwork — on the same GameObject, handles network trigger registration

  • TableArea — on a child GameObject, manages the physical item detection zone

All item queries delegate to tableArea.Items with filtering. GetItem() returns the first unreserved ShopItem, while HasAvailableItem checks if any unreserved items exist. HasAnyItem checks for any items regardless of reservation state.

Quick Lookup

Goal
How

Check if table has items

table.HasAnyItem

Check if unreserved items exist

table.HasAvailableItem

Get first available item

table.GetItem() — returns null if none

Access the trigger area

table.Area

Access the Interactable

table.Interactable

Properties

Interactable

The Interactable component on this GameObject, used by the interaction system.

Area

The child TableArea that detects items entering/leaving the table bounds.

HasAnyItem

Whether the table has any items (reserved or unreserved). Delegates to tableArea.Items.Any().

HasAvailableItem

Whether the table has at least one unreserved item. Delegates to tableArea.Items.Any(item => !item.IsReserved).

Methods

GetItem

Returns the first unreserved ShopItem on the table, or null if no available items exist.

Returns: The first ShopItem where !IsReserved, or null.

Lifecycle

Common Pitfalls

circle-exclamation
circle-exclamation
circle-exclamation

See Also

Last updated