FN_Interactable

This component allows objects in the warehouse game to be interactable by the player, including prompts, conditional activation, and modular reusability.

Key Logic Snippet

// Returns true if task is null or currently active
public bool IsActive()
{
  if (linkedTask == null) return true;
  if (!linkedTask.RequiresActiveStatus) return true;
  return FN_TaskManager.Instance != null &&
         FN_TaskManager.Instance.IsTaskActive(linkedTask);
}
This method checks whether an interactable object should currently be usable based on task status.
Screenshot of IsActive logic in editor

Interaction Method

public void Interact()
{
  if (!IsActive()) return;

  if (!bl_hasInteracted || bl_isReusable)
  {
    onInteractEvent?.Invoke();
    bl_hasInteracted = true;
  }
}
Only allows the player to interact if the object is usable, either for the first time or marked reusable.
Screenshot of Interact() method in Unity

Prompt Display

public void ShowWidget()
{
  if (!IsActive()) return;
  if (go_Interact_Widget != null)
  {
    go_Interact_Widget.SetActive(true);
    if (txt_prompt != null)
      txt_prompt.text = st_interactionPrompt;
  }
}
When within range, this method activates a shared UI prompt above the object (like "Press E to Interact").
In-game example of interaction prompt showing above object
← Return to Warehouse Game Overview