Game Development Reference
In-Depth Information
To disable the Gnomatic Garden Defender's navigation, you will have to prevent movement and the
two mouse looks. With the weapon, you could deactivate the object because there was no Mesh
Renderer on it. With the Gnomatic Garden Defender, you will be disabling the CharacterMotor and
MouseLook scripts.
Inside the GameOver function, add the following:
6.
// disable navigation
GameObject.Find("Gnomatic Garden Defender").GetComponent<CharacterMotor>().enabled =
false;
// disable turning
GameObject.Find("Gnomatic Garden Defender").GetComponent<MouseLook>().enabled = false;
//disable weapon aiming
GameObject.Find("Arm Group").GetComponent<MouseLook>().enabled = false;
7.
Save the script.
8.
Click Play and test.
The character no longer responds, but the zombie bunnies keep falling.
Unity 2D
While the text countdown gives the player the information about the remaining battery life, it is rather
boring. More typically, you will see progress bars for things like health and other parameters that
work on percent of a whole. HUDs, or heads up displays , provide a means of keeping the player
informed without having to suspend game play to access a separate menu or stats page.
With the addition of several new features, Unity has made the authoring of HUDs and fully 2D games
much easier. The dedicated 2D physics engine and sprite tools are well implemented and easy
to use. For your 3D game, you will be adding a few sprite-based embellishments to entertain and
distract your player.
Basics
This game is obviously 3D in nature, but it will definitely benefit from some 2D elements. You will be
using textures for those, but their preparation is quite a bit different than textures used on the 3D
objects.
2D Mode
There are a few things you can do to make 2D authoring more efficient. If your game is going to be
fully 2D, you can select the option when you create a new project (Figure 9-4 ).
 
Search WWH ::




Custom Search