So far I manage to code a simple script to do a primitive actions.
Here is a video for the demonstration of how the script work.
First the script detects if the player character standing nearby the NPCs and then trigger a guide button which I put statically;
Press E to talk.
The green boxy guidelines are the box collider in Unity that used as a trigger detector.
After the player press E, the script then trigger a functions to show the subtitle and play the speech.
I can make the subtitle to be dynamically inserted through the Unity editor but I think in future this won’t be enough. I was thinking to add a feature where I can add another line of subtitle dynamically, as well as the speech audio file. Currently the script only show 1 line of subtitle and play the attached audio clip. Will add more feature soon.
When player moving away, the script trigger another function to dismiss the subtitle and the guide button.