Game Development Reference
In-Depth Information
public static class NavigationManager
{
public static Dictionary<string,string> RouteInformation
= new Dictionary<string,string>()
{
{ "World", "The big bad world"},
{ "Cave", "The deep dark cave"},
};
public static string GetRouteInfo(string destination)
{
return RouteInformation.ContainsKey(destination) ?
RouteInformation[destination] : null;
}
public static bool CanNavigate(string destination)
{
return true;
}
public static void NavigateTo(string destination)
{
// The following line is commented out for now
// as we have nowhere to go :D
//Application.LoadLevel(destination);
}
}
Note
Notice the ? and : operators in the following statement:
RouteInformation.ContainsKey(destination) ?
RouteInformation[destination] : null;
These operators are C# conditional operators. They are effectively the shorthand of the
following:
Search WWH ::




Custom Search