Game Development Reference
In-Depth Information
8.
Save the script.
9.
Select the GardenGates object from Common Wall 2, and set its Can
Activate Game parameter to true .
Leave any doors that do not lead into a garden as false .
10.
In the OnTriggerEnter function, inside the ... tag == "Player" conditional,
add the following:
11.
if (canActivateGame) SetGameOn(); // get the game underway
The logic to this system is that you must start the game from a non-garden area. Once the game is
underway, the Gnomatic Garden Defender should not be able to enter other garden zones until the
current one is finished.
And then create the SetGameOn() function that does the work:
1.
void SetGameOn () {
// turn off the flag
canActivateGame = false;
// activate the Garden HUD sprites
gardenHud.GetComponent<ChildVisibility>().SpriteToggle(true);
// send a message to start the additional bunny drops
bunnySpawner.StartCountdown();
// set battery drain on
batteryLife.trackingBattery = true;
}
2.
Save the script.
3.
Select the GardenGates object from Common Wall 2.
4.
Drag the appropriate objects into the three new parameters (Figure 10-30 ).
Figure 10-30. The new parameters loaded in the Sensor Doors component
 
Search WWH ::




Custom Search