Game Development Reference
In-Depth Information
Connecting the dots
So now that we have something to talk about, we just need to be able to attach it to the
characters and then start displaying it on the screen for the player to interact with.
Note
This topic will cover the GUI system in more depth in Chapter 8 , Shopping for Weapons ,
so it will just include some basics here. You can come back and update your styles here
later if you wish.
First, we need an empty class for our NPCs, which is derived from the Entity object.
So, create a new C# script named Npc in the Classes folder under Assets\Scripts
and replace its contents with the following code:
using UnityEngine;
public class Npc : Entity
{
}
Tip
It might seem a bit redundant to just create an empty script for our NPCs as we are not
adding anything to them yet; you could just attach the Entity script to them instead. Re-
member that as soon as we want to add something for NPCs to use or make use of, we
will have to go round and change all of them later. Always plan for expansion; it costs
nothing in the beginning but a potential fortune later.
With that created, add the script to our three NPCs in our scene. (Don't forget to name
your characters in the Inspector pane as well.)
Next, add the Conversation Component to the Greybeard's NPC and then drag the con-
versation we just built to that character in the Conversations array.
The Inspector pane should now look like the following screenshot:
Search WWH ::




Custom Search