Game Development Reference
In-Depth Information
In Chapter 8, “Animating the Zombie,” you created several animations and docu-
mented them according to their place in the timeline. These animations are recapped in
Table 10.1.
Table 10.1
Zombie animation
chart
CHARACTER
IDLE
WALk
CHASE
RUN
Zombie professor
1-240
242-332
334-385
387- 408
Now you'll use these frame numbers in Unity to import your animations:
1. In the List panel, click the + button at the right side of the panel. This adds an anima-
tion slot with the default title of Idle.
2. Under Start, leave the frame as 1. Under End, type 242 . Under WrapMode, select
Loop from the list, and then leave the check box under the Loop portion of the list
deselected.
3. Add the other animations by typing the values from the table into the panel, as
shown in Figure 10.5.
4. Click the Apply button to apply these animation settings.
Now that you've imported your zombie, you can make it do
things within the engine. In the next section, you will get a quick
introduction to scripting that will help you make the zombie
attack the player.
Figure 10.5
Naming and mak-
ing your animations
accessible to Unity
Unity Scripting—A Crash Course
Unity itself is a very artist-friendly environment, featuring a WYSIWYG (What You See
Is What You Get) interface, drag-and-drop object construction, and lots of packed-in
Prefab objects. However, your amazing Blender-created game art will be “all dressed
up with nowhere to go” unless you can give it in-game behaviors with Unity scripting.
Scripting is a huge topic that cannot be thoroughly covered in just one chapter and, in
fact, deserves a topic entirely its own. he good news is that once you understand a few
key concepts, you will be on your way to Unity scripting mastery. This section will give
you an overview of three elements of Unity scripts that will get you quite far: variables,
functions, and conditional statements.
Using Variables
One of the first elements of Unity scripting encountered by users is the variable . Variables
are common among many types of programming languages and act like containers for
storing information. They are typically declared either at the beginning of a script or as a
function with the following syntax:
var myNumber : int = 3;
 
Search WWH ::




Custom Search