Cameraare the camera markers and the ones named like
Rightare character markers.
MoveCamera()and it looks like this:
camerathat takes a location name and knows to pass it off to the
MoveCamera()function in C# to make it happen. This will mean when the player has to move to the bridge, the Yarn script can just say
Awake()that every Unity object has by default. This function is called when the object is created, and because our empty Scene Director object is always in the Scene this means it gets created as soon as the Scene does. Registering Command Handlers in the
Awake()function of this object therefore means they will be registered before anything else happens when the game is run.
Awake()function of SceneDirector.cs:
camerathat has a parameter of type
Locationand will defer to the function
MoveCamera()to make it happen.
<<camera (location name)>>to the appropriate places:
<<camera Corridor>>to the top of the Start node.
<<camera Bridge>>to the top of the node where characters should move to the bridge.
<<camera Title>>at the top of Start and then a call to the inbuilt
<<wait (number of seconds)>>command to hold for a second or two before moving to the Corridor.
Awake()function that finds the objects of type Fade Layer in the Scene (there is only the one) and keeps it in a variable called
fadeLayer, similar to how the Dialogue Runner was found earlier.
FadeOut()that do just that, by changing the opacity of this stored layer over the given number of seconds (or defaulting to 1 second if no argument is provided).
MoveCamera()function did, these functions return a
Coroutine. This gives Yarn Spinner a handle to the process it triggered so that for operations that take time (like fading in a screen over a second or so) it knows not to trigger the next line of dialogue until that process has completed.
fadeOutworks just like before. In the
Awake()function of SceneDirector.cs by adding Command Handlers to the previously found Dialogue Runner.
<<fadeIn>>to either side of each camera or node change to make nice fade-to-black transitions between story parts. Because no argument is provided, this will perform a 1 second fade.
Move()that accepts a
Locationobject and the name of a marker in that Location. It looks very similar to the
MoveCamera()function used earlier:
MoveCamera(), Yarn Spinner is able to find the Game Object you are trying to command by searching the Scene for one with the right type and name. This is used to find the Location that should be passed as the first function argument, but also to specify the target Character this function should be called on.
<<place (location) (marker name)>>we need to add an extra argument in between to specify the target Character object:
<<place (character) (loc...>>.
Awake()function would be called every time any Character was created. This would result in the Dialogue Runner receiving multiple registrations of command with the same name but that are requested to pass off to different objects. Yarn Spinner won't allow that, so we have to instead annotate the relevant functions using the Yarn Command decorator.
[YarnCommand("command name")]to the declaration of a function. Add the following decorator to just above the
<<place (character name) (location) (marker name)>>wherever needed. Placing characters before calling
<<fadeIn>>will ensure they are there before the shot appears, so the Character won't seem to pop into existence a fraction later.
SetPose()function in Character.cs accepts the name of a pose and tells the animator attached to the Character model to move the model to that pose. The available poses for each model are defined by their underlying type seen in Assets > Art > CharacterBaseModels and the Asset Package has come with the following for both male and female models:
placecommand, add a decorator to
SetPose()to declare a command called
<<pose (character) (pose name)>>wherever called for in the script. In particular, adding appropriately unhappy-looking poses during the Bridge scene will make Characters seem to respond to the story.
[YarnCommand("expression")]and, back in the Yarn script, place calls to
<<expression (character) (expression name)>>wherever appropriate.