Game Development Reference
In-Depth Information
Listing 35: Switchable trigger script
Before going into the details of SwitchableTrigger itself, let's jump to lines 72 through 76
and 79 through
83. In these lines we have two small classes that are a bit different than scripts we are
used to. Firstly, notice that they do not extend MonoBhaviour , and, secondly, they have the
[ System.Serializable ] before class declaration. These classes are going to be used as boxes
that combine a number of variables. For example, if I declare a variable of type Trigger-
State , this variable includes two variable inside it: restTime and the array messagesToSend .
The importance of [ System.Serializable ] is it makes variables of this class visible in the
inspector, just like all variable types we have been using up to now.
Search WWH ::




Custom Search