Game Development Reference
In-Depth Information
The script has three functions that change the value of
currentSpeed
, which is the variable
that directly affects the rotation speed of the fan. Additionally, the script has
SwitchOff()
function which sets the speed to zero, hence stops the rotation. To control the fan, we attach
SwitchableTrigger
script to the switch in the middle of the room. We need to setup the
script as in Illustration 42.