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.
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.
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").