Game Development Reference
In-Depth Information
//Dialog detail—updated to get better detail
GUI.Label(
new Rect(15, 10, 300, 68),
"Do you want to Enter the Shop? (Press up)");
//layout end
GUI.EndGroup();
}
}
Trying to enter the shop isn't going to get us very far if the game doesn't know it exists, so
add this logic to the
Build Settings
project and also update the
NavigationMan-
ager
script to include a new
Route
asset for the shop, as follows:
public static Dictionary<string, Route> RouteInformation =
new Dictionary<string, Route>() {
{"Battle", new Route {CanTravel = true}},
{"World", new Route {RouteDescription = "The big bad
world", CanTravel = true}},
{"Cave", new Route {RouteDescription = "The deep dark
cave", CanTravel = false}},
{"Home", new Route {RouteDescription = "Home sweet home",
CanTravel = true}},
{"Kirkidw", new Route {RouteDescription = "The grand city
of Kirkidw", CanTravel = true}},
{"Shop", new Route {CanTravel = true}},
};
With the scripts in place, we now need to add them to the player's home in front of the
shop. Open the
Home
scene and add a new empty game object named
Shop
as a child of
the
WorldBounds
grouper game object (because it takes us out of the scene), attach the
ShopEntry
script, and add a
Box Collider 2D
component (set as a trigger), as shown in
the following screenshot: