Game Development Reference
In-Depth Information
Chapter 9
Incorporating Unity 2D
With Unity's major push into the mobile market and Adobe's announcement that Flash would not be
supported for Mobile, Unity stepped in and beefed up its 2D capabilities with the addition of several
very nice features and options. While your game is mainly 3D, you will be taking the opportunity in
this chapter to cover some of the basics by incorporating a 2D warning system into the game as
an added stressor for your player. Before jumping fully into the newer features, you will finish up the
scoring system.
Finalizing the Game Play
Currently, you are tracking only the number of zombie bunnies in the garden. And because they are
constantly being replenished, you are probably having a hard time eradicating them. The first thing
to address is a means of rewarding the player as he scores more hits. It would be useful to have the
current number displayed in the game.
Legacy GUI Text
Unity has a few different ways to put text on screen. You will begin with the oldest method, the GUI
Text object. For nonprogrammers, it has the advantage of being a gameObject that can be seen and
manipulated like any other. The newer UnityGUI, in contrast, is a solely script-based system. You will
get a bit of practice with it as well, but as it tends to be too slow for most mobile applications, you
won't spend much time on it.
Let's see about getting the score on screen first. Putting text on screen is fairly easy, but in the code,
the numbers will have to be converted to characters. Because 2D objects do not show in the Scene
view, this is a good time to switch to the Default layout.
1.
If you aren't already using it, switch to the Default layout and click the
“Game view” tab.
2.
Delete the Slug from the scene, and disable the Plant Zone objects for now.
389
 
Search WWH ::




Custom Search