Game Development Reference
In-Depth Information
Chapter 10
Menus and Levels
In the previous chapter, you implemented a means to end the game, the current level, or maybe
just the current garden. With most of the game play in place, you will be delving into the concept of
using levels for menus as you begin wrapping up the game. In the topic, your game will have only
one garden level, but the menus you will add can also be considered levels. With the addition of the
menus and the elements required to navigate between them, you will be using the second of Unity's
GUI offerings, Unity GUI.
Unity GUI is a solely scripted feature, but it has the benefit of a CSS-type implementation that makes
it easy to create visual continuity throughout the game's GUI (graphical user interface). But because
Unity GUI is very slow on mobile devices, Unity is in the midst of developing a third GUI system that
promises to make layout, sizing, and speed top priorities. As no hints of a release date have been
made at the time of this writing, you will be using Unity GUI for the remainder of the project. When
the new GUI becomes available, be sure to check the topic's page on the Apress website for an
introduction to the new system using this chapter's GUI assets.
Ending the Game
Currently, when the player has run out of battery life, the game is over. Conversely, if the player
has destroyed all of the invading zombie bunnies, the game, level, or individual garden has been
secured. In the first scenario, as well as the out-of-battery scenario, the player should be offered the
option to “Play Again” or “Quit.” With both scenarios, it will also be nice to have a message telling
the player whether the garden has been lost to the invading hordes or secured.
For the end-of-game GUI, you will simply add the text and buttons to the existing scene.
Unity GUI
In the previous chapter, you used GUI Texture objects to add text to your HUD. This time you will be
using the script-based Unity GUI. Besides the scripting API that creates the functionality, the Unity
GUI has several preset templates that are associated with elements such as buttons, boxes, sliders,
and labels.
447
 
Search WWH ::




Custom Search