Skip to content

IInteractableAction

Namespace: FireSoftworks.Interaction
Assembly: FireSoftworks.Interaction
Type: Interface

Interface representing a single, reusable interaction action. Examples: Consume, Pickup, Read, Open, etc. Implement this interface to create custom interaction actions.

public interface IInteractableAction

Methods

Execute(InteractionContext)

Executes the action logic when the player selects this action. Implement this method with your specific action behavior. By default, it simply invokes the OnExecuted event.

void Execute(InteractionContext context)

Parameters

NameTypeDescription
contextFireSoftworks.Interaction.InteractionContextThe interaction context containing information about the interactor and environment.

IsAvailable(InteractionContext)

Determines whether this action is currently available in the given context. Override this method to implement conditional action availability. By default, all actions are available.

bool IsAvailable(InteractionContext context)

Parameters

NameTypeDescription
contextFireSoftworks.Interaction.InteractionContextThe interaction context containing information about the interactor and environment.

Returns: True if the action can be executed, false otherwise.

Propertys

Icon

Optional sprite/icon for this action to be displayed in the HUD. If null, only the label text is displayed. This icon appears to the left of the action label.

Sprite Icon { get; }

Id

Stable technical identifier for this action (e.g., “consume”, “pickup”). This is used internally for sorting and identifying actions programmatically.

string Id { get; }

Label

Human-readable label for UI display (e.g., “Eat Apple”, “Pick Up Item”). This text is shown in the HUD when this action is available.

string Label { get; }

OnExecuted

Optional event fired after the action executes. Can be used to trigger UI updates or apply item effects.

[Tooltip("Optional event fired after the action executes.")]
UnityEvent<InteractionContext> OnExecuted { get; }

ShowWhenUnavailable

Determines if this action should be displayed in the UI when it’s not available. Default is true (show when unavailable). Set to false to hide this action from UI when not available. Only affects visibility - doesn’t impact selection or execution logic.

bool ShowWhenUnavailable { get; }