From the course: Unity 5: Build a Character Dialogue System
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Finish the JsonFactory - Unity Tutorial
From the course: Unity 5: Build a Character Dialogue System
Finish the JsonFactory
- [Instructor] Let's keep flushing out the black box functionality of our JSONFactory class. Our main method is going to return a narrative event based on whatever scene number we pass in as a parameter. So let's declare a public static NarrativeEvent return type. We're going to call this method RunJSONFactoryForScene, and as a parameter we're going to pass in an integer. We're going to name that sceneNumber. The first thing we're going to need inside this method is a resource path. So let's declare a local variable inside the function. String resourcePath = PathForScene, and we're going to pass in sceneNumber. You're going to get an error because path for scene doesn't exist yet. So here on line 24, let's mock out our helper function. Private static string PathForScene. It's going to take in an integer. We're also going to call that sceneNumber. The path for scene method is going to go into our resource list and look up our entries. Now if it exists it's going to return the correct…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.