Skip to content
This repository has been archived by the owner on Apr 2, 2022. It is now read-only.

Character Profile and Item Inventory

cli727 edited this page Oct 26, 2017 · 3 revisions

Dialogue System

Our game has a completely original dialogue system coded from scratch. The mechanism behind it is to have one central dialogue manager which is responsible for displaying dialogue boxes and their corresponding texts. The dialogue manager holds only one box and therefore only one set of dialogue lines at a time.

Each NPC character has a dialogue holder script, which has a set of dialogue boxes. It determines when to move on to the next dialogue box internally, and updates the dialogue manager with the currently active dialogue box. The NPC also sets itself as the current active NPC in the dialogue manager, when the player collides with them, and sets the current active NPC back to null when the player exits the collider, so that the dialogue manager does not update any dialogue lines when the players accidentally press [space] but is not talking with any NPC.

Finally, each dialogue box has an NPC image and NPC name, with a text holder, which holds the dialogue lines for the NPC. The content of the dialogue lines can be manually typed in the Unity inspector or selected from a text file as a text asset.

Item Inventory

The item inventory is originally taken from the Asset Store (see Acknowledgement), and further modified to fit the purpose of our game. Specifically, the item description that originally shows up on a tooltip (can be seen in prototype) is taken and replaced by a item description box at the bottom of the inventory (as seen in final). Players can click on each item to bring up their respective descriptions. Other scripts have also been modified to integrate with the random item spawn manager, so that when given a range of items from the database, they can be spawned randomly at various pre-defined positons.

Character Profile

The character profile is also from the ready-made asset, with heavily-modified UI and completely original scripts. A button prefab is made on-the-fly as each NPC gives their statements, and put into a scroll pane. The statements are made into buttons so that onClick events can be easily called when players later select item and statement pairs to find contradictions in the NPC conversations.

Statements that have to be stored in the character profile are tagged. When the dialogue manager comes across such a statement, it would update the character content manager to store the statement in the corresponding NPC's page.

Character content manager holds the NPC statements in an ordered dictionary data structure. Each key in the ordered dictionary is the NPC's name, and each value is a KeyValuePair object, with the key being the NPC's image, and the value being a list of strings consisting of its statements. As the dialogue manager updates the content, it would give its current active NPC information, e.g. NPC name and NPC image, with the corresponding statement store. The character content manager uses this information and updates its dictionary structure.

Clone this wiki locally