Talk

This script should sit on your player.

Public fields:

PlayerBubbleChatColor The color of the chat bubble when the player is speaking
maxDistance NPC won’t be detected past that threshold (Unity units)
TalkKey Key pressed to trigger a conversation

NOTES:


Dialogue Container

This script should sit on each entity (NPC) you want to make possible to have an interaction with.

Public fields:

PrefabUI The prefab containing the actual chat bubble in world space.
NPC_Color Color of the chat bubble when the NPC is talking. Make sure the Talker Name corresponds to the name of your game object if you want this to work.
Conversations All the conversations this NPC can have. When the conversation is finished, the next one will be played.

As Conversations is actually a struct, it has multiple fields on its own.

Length The box with a number on the rightmost side of Conversations. It should not be set to 0.
Is Player Talking - Not implemented yet -
Talker Name The name of the NPC. If the name is the same as the name of the Game Object (at the top of the hierarchy), then the speech bubble will be of the color you picked in NPC_Color.
The Talker Name will be displayed in bold, above the text of the dialogue.
If that field is left blank, only the dialogue will be displayed.

(This system could largely be improved, and is a priority.) | | Lines | This is the text of the conversation. Every line will be displayed after the other after pressing the talk key. When all lines are exhausted, the chat bubble will close. If there are more that one conversation, the next ones will be played when the conversation is over and the player is talking to the NPC again. |

NOTES: