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

  1. Setting up the structure
  2. Setting up the triggers

Setting up the structure

First, let's open the Structure editor window:
StructureMenu

We have a new window, we'll leave most options as is and increase the length of the room:
StructureWindow

We'll do that two times, resulting in two rooms connected by a door:
StructureDefault
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:
Assets

Setting up the triggers

Like we did for the Structure editor, let's open the Triggers editor:
TriggersEditorMenu

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":
CreateATrigger
Press the "Create trigger" button to create it.

We then use the Modify icon Select button to start working on this trigger:
Select 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 Add button to create a new action. The action appears in the Routines panel, under "Actions". We use the Modify icon Select button to parameter it, displaying the node editor:
AddAction

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:
DragDrop
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:
Filter

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:
AddCondition

We do the same for the "On keyboard down" (filter: Events, Inputs > On Keyboard down, Key Code: Backspace):
AddEvent

We press play, to try it:
LightsOn
Because these lights are on by default, they are on when we press play.

We keep looking at the neon and press "Backspace":
LightsOff
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.