Example Making a scenario - Zelgunn/Unity3DTools GitHub Wiki
Example - Making a scenario
In this example, we will be using both the Structure and the Triggers editor. Some assets and nodes are part of another project in progress.
Table of Contents
Setting up the structure
First, let's open the Structure editor window:
We have a new window, we'll leave most options as is and increase the length of the room:
We'll do that two times, resulting in two rooms connected by a door:
Note that you change the size, the appearance, the name and the position of the rooms if you want to.
Now, let's import some assets:
Setting up the triggers
Like we did for the Structure editor, let's open the Triggers editor:
In this example, we will lower the light coming from a neon, using the backspace touch, when the player can see the neon. To do that, we first have to create a trigger that we will call "Shut down lights":
Press the "Create trigger" button to create it.
We then use the Select button to start working on this trigger:
We want to lower the lights, so we need an action to do so. Let's go in the Node Browser > Lights > Set light intensity. We press the Add button to create a new action. The action appears in the Routines panel, under "Actions". We use the Select button to parameter it, displaying the node editor:
We need to specify which light we want to affect, we can do so by drag-and-dropping the light from the Hierarchy to the node:
We want the intensity to become 0, so we will leave the "Intensity" field as is.
We only want the light to shut down if the player can see it, so we need a Condition node for that. There are plenty of nodes, especially if you created custom nodes. We will use the filter at the top of the node browser to save some time:
We go find "Player can see object" under "Player" in the Node browser, add it, select it and drag the Neon in the "Target" field:
We do the same for the "On keyboard down" (filter: Events, Inputs > On Keyboard down, Key Code: Backspace):
We press play, to try it:
Because these lights are on by default, they are on when we press play.
We keep looking at the neon and press "Backspace":
The light is off, the light component of the neon is separated from what makes it white, so it feels like we just reduced the light intensity. To change that, we could for example add another action that specifically lowers the white of the neon.