Skip to main content

Class InteractionView

Provides the visual representation of available interaction options to the user. Responsible for showing prompts, updating progress visuals, and managing UI lock states.

public class InteractionView : MonoBehaviour

Inheritance​

Properties​

IsVisible​

Whether the interaction UI is currently displayed.

public bool IsVisible { get; }

Property Value​

bool

OptionCapacity​

Number of option slots this view can display at once.

public int OptionCapacity { get; }

Property Value​

int

Methods​

FocusOption(int)​

Locks all interaction options except the one specified by index.

public void FocusOption(int index)

Parameters​

NameTypeDescription
indexintIndex of the option to remain unlocked and focused.

Hide()​

Hides the interaction UI.

public void Hide()

LockOption(int)​

Locks a specific interaction option UI element.

public void LockOption(int index)

Parameters​

NameTypeDescription
indexintIndex of the option to lock.

ReleaseAllLocks()​

Releases all locks from every interaction option UI element.

public void ReleaseAllLocks()

ReleaseLock(int)​

Releases the lock on a specific interaction option UI element.

public void ReleaseLock(int index)

Parameters​

NameTypeDescription
indexintIndex of the option to unlock.

Show(IReadOnlyList<InteractionOptionDisplay>)​

Shows the interaction UI and populates each prompt slot from the supplied display data.

public void Show(IReadOnlyList<InteractionOptionDisplay> options)

Parameters​

NameTypeDescription
optionsIReadOnlyList<InteractionOptionDisplay>Display data for each option, in slot order. Slots beyond the supplied count are hidden.

Remarks​

The view deliberately takes presentation data rather than an Interactable so it stays independent of the interaction domain model.

UpdateFill(int, float)​

Updates the fill amount (e.g., progress bar) for the specified interaction option UI element.

public void UpdateFill(int index, float fillAmount)

Parameters​

NameTypeDescription
indexintIndex of the interaction option to update.
fillAmountfloatFill amount value between 0 and 1.

OptionHeld​

Raised each frame while the player holds an option prompt. The argument is the option's slot index.

public event Action<int> OptionHeld

Event Type​

Action<int>

OptionPressed​

Raised when the player presses an option prompt. The argument is the option's slot index.

public event Action<int> OptionPressed

Event Type​

Action<int>

OptionReleased​

Raised when the player releases an option prompt. The argument is the option's slot index.

public event Action<int> OptionReleased

Event Type​

Action<int>

  • Properties
    • IsVisible
    • OptionCapacity
  • Methods
    • FocusOption(int)
    • Hide()
    • LockOption(int)
    • ReleaseAllLocks()
    • ReleaseLock(int)
    • Show(IReadOnlyList<InteractionOptionDisplay>)
    • UpdateFill(int, float)
    • OptionHeld
    • OptionPressed
    • OptionReleased