InteractableTarget
Namespace: FireSoftworks.Interaction
Assembly: FireSoftworks.Interaction
Type: Class
Default implementation of IInteractable that aggregates interaction actions from attached components and ScriptableObjects. This component should be attached to GameObjects that can be interacted with. Actions are discovered by finding all IInteractableAction components on the same GameObject and combining them with manually assigned ScriptableObject-based actions.
Features:
- Action discovery and caching from both components and ScriptableObjects
- Lifecycle management (OnFocusEnter/OnFocusExit)
- Automatic action sorting by ID
- Transparent coexistence of component-based and ScriptableObject-based actions
[DisallowMultipleComponent]public class InteractableTarget : MonoBehaviour, IInteractableMethods
GetAllActions()
Returns ALL actions on this interactable (both available and unavailable). Combines both component-based and ScriptableObject-based actions. This is used for UI display to show the complete action set, with filtering applied by the UI layer. The returned list is sorted by action ID for consistent ordering.
public List<IInteractableAction> GetAllActions()Returns: A sorted list of all actions on this interactable.
GetAvailableActions(InteractionContext)
Returns a list of actions that are currently available in the given context. Combines both component-based and ScriptableObject-based actions. Actions are cached on first access and filtered based on their availability. The returned list is sorted by action ID for consistent ordering.
public List<IInteractableAction> GetAvailableActions(InteractionContext context)Parameters
| Name | Type | Description |
|---|---|---|
context | FireSoftworks.Interaction.InteractionContext | The interaction context containing information about the interactor and environment. |
Returns: A sorted list of available actions in the current context.
GetGameObject()
Returns the GameObject of this interactable.
public GameObject GetGameObject()Returns: This GameObject.
GetTransform()
Returns the Transform of this interactable.
public Transform GetTransform()Returns: This Transform.
OnFocusEnter(InteractionContext)
Called when the Interactor first focuses on this object. Applies the outline shader to the object.
public void OnFocusEnter(InteractionContext context)Parameters
| Name | Type | Description |
|---|---|---|
context | FireSoftworks.Interaction.InteractionContext | The interaction context containing information about the interactor. |
OnFocusExit()
Called when the Interactor stops focusing on this object. Removes the focused material and restores the original materials.
public void OnFocusExit()RefreshActions()
Clears the cached actions list, forcing the component to rediscover actions from components and ScriptableObjects on the next access. Use this if actions are added or removed dynamically at runtime.
public void RefreshActions()Propertys
_cachedActions
Cached list of actions found on this GameObject. Populated on first access to GetAvailableActions, combining both component-based and SO-based actions.
public List<IInteractableAction> _cachedActions { get; set; }