Game Development Reference
In-Depth Information
Note
To make the Inspector pane look a bit prettier, be sure to check out the editor extensions
in Chapter 10 , The Battle Begins .
So now that our character has a script and that we have the ConversationManager
set up, we just need to trigger the conversation when the hero tries to enter the dark cave.
At the moment, the NavigationManager script that we used will let the player go
anywhere. So first let's update that and add a bit more flexibility and configuration for the
routes that the player can follow.
Open up the NavigationManager script in the Navigation folder under As-
sets\Scripts and create a new struct method as follows:
public struct Route
{
public string RouteDescription;
public bool CanTravel;
}
The preceding code now enables us to have a simple mechanism to say whether a route is
traversable or not. (In real scenarios, this should be serialized or it should have a manager
for the player to remember where the player has traveled; otherwise, it is never going to
get unlocked.)
Next, we need to update the RouteInformation variable to use this new struct
method and update the information for the two destinations that we have already con-
figured in our manager. This should enable us to state that you can travel to the big bad
world but not to the cave as follows:
public static Dictionary<string, Route > RouteInformation =
new Dictionary<string, Route>() {
{ "World", new Route { RouteDescription = "The big bad
world", CanTravel = true}
},
{ "Cave01", new Route { RouteDescription = "The deep dark
cave", CanTravel = false}
Search WWH ::




Custom Search