Game Development Reference
In-Depth Information
It starts with the GameObject enemyTank, then goes to the transform
component, then drills down to the rotation part of that component and
then the Y value and enters 60 for its value. Note that enemyTank is a name
known only to the script; the name of the object in the hierarchy could be
something entirely different. Later, we'll look at how to let the script know that
enemyTank is actually the object that we named MyAwesomeTank in Maya.
Also later we will look at how this can be used to define variables in other
scripts, and even other scripts attached to other GameObjects. When any
script can talk to any other script, very sophisticated things can happen.
Getting to It
That of course isn't everything about scripting. There's loads and loads of
powerful functionality there (if-then statements, counting, lerping, etc.), but
much of this is best understood in practice rather than endless descriptions
of what code is. In the tutorials of this chapter, we will be writing some scripts
using the basics described here, and then talk about what we've done. Along
the way new ideas will be presented, so be sure to read the Why? sections.
To get going on scripting, we're first going to build a GUI that we can use the
scripting mechanism on.
Tutorial 12.1: Graphical User Interfaces
Graphical User Interfaces (GUI—often pronounced “gooey”) are basically the
way the user interacts with the computer or program, and usually in ways
besides entering text (like through a command line). Computer and web users
are very familiar with GUI today, and in fact, most users would be lost without it.
GUI in games are important parts of the gamer's experience. At its most basic
level, a GUI will help a player know how to start playing the game after he's
been given instructions. In games, GUI has also come to include screen hints
or other information that helps the player know what to do and when to do it.
The most elegant games provide this guidance in much more intuitive ways,
but we will look at some straightforward (but clumsy) methods of providing
guidance in the game for the player.
To start with, though, we will use our opening scene as a vehicle to provide a
bit of background on the character as well as define the goals of the game.
To do this we will make use of Unity's GUITexture mechanism.
GUITexture
The name of GUITexture gives us some hints as to what sorts of assets it likes
to work with—textures. Because it is a texture, it means that Unity will be
using an image that it draws on the screen. For this opening GUI ( Figure 12.1 ),
we will be using several images—a logo, three buttons (mission, bio, begin),
two data panels (one to show the mission and another for Aegis's bio info),
and finally a Loading plate.
Search WWH ::




Custom Search