3DPlatformTutorial.pdf

(14963 KB) Pobierz
3D Platform Tutorial 3rd Edition rev 2
3D Platformer Tutorial
Building a 3D Platform Game in Unity 2.0
741441649.003.png 741441649.004.png
Contents
What you will learn
5
What you should already know
6
Project Organization
6
Files
7
Typographical Conventions
7
Unity Conventions
8
Projects
8
GameObjects, Components, Assets & Prefabs
8
GameObjects
8
Components
9
Assets
9
Prefabs
9
Acknowledgments
10
Animating Lerpz
11
The Plot
11
Introducing Lerpz
12
The Character Controller & the Third Person Controller script
19
Animating Lerpz
19
Character Animation
20
Animation blending
20
The Third Person Player Animation script
20
Gizmos
21
The Jet­Pack
22
Adding the Particle Systems
23
Adding the Light
26
Blob Shadows
29
Adding a Blob Shadow
30
Creating a new Layer
31
Scripting Concepts
33
Organization & Structure
34
Death & Rebirth
36
741441649.005.png
The Fallout Death script
37
Respawn Points
38
How it works
40
First Steps
42
Placing Props
43
Health Pickups
43
The Force Field
44
Scripting the Collectable Items
45
Jump Pads
48
4. The GUI
The User Interface
50
Unity 2's new GUI system
50
Further Information
51
The In­game HUD
51
The GUI Skin object
52
The Start Menu
56
Setting the Scene
57
The Backdrop.
58
The Buttons.
60
Game Over
64
Antagonists & Conflict
69
The Laser Traps
69
Implementing the Laser Traps
70
The Laser Trap Script
73
Overview
73
The Robot Guards
75
Divide & Conquer
77
Spawning & Optimization
79
How it works.
80
Introduction
83
Audio
83
Sample Notes
84
Adding Sound to Lerpz Escapes!
84
Ambient Sounds
86
The Jump Pads
87
Collectables
88
The Impound Fence
90
741441649.006.png
The Player
90
The Robot Guards
94
Cut Scenes
96
Unlocking the impound fence
96
Why Optimize?
110
Optimizing Rendering: Monitoring Frames Per Second
110
Making sense of the Stats display
111
Optimizing Rendering: The Two­Camera System
112
The Road Less Travelled
114
Suggested Improvements
114
Fixing the deliberate mistakes
114
More levels
115
More enemies
115
Add scoring
115
Add a networked high­score system
115
Add multiplayer support
115
Further Reading
115
StartMenuGUI script
116
GameOverGUI
117
GameOverScript
118
ThirdPersonStatus
118
LevelStatus
120
HandleSpaceshipCollision
122
741441649.001.png
Introduction
Unity is a powerful tool for game
development, suitable for many
game genres, from first­person
shooters to puzzle games.
With its myriad features, including height­mapped terrains, native networking sup­
port, complete physics integration and scripting, Unity can be daunting for newcom­
ers, but mastering its many tools is infinitely rewarding.
This tutorial will walk you through the process of building a complete 3D platform
game level with a third­person perspective view. This includes everything from player
controls, collision detection, some advanced scripting, blob shadows, basic AI, adding
a game HUD, cut­scenes and audio spot effects.
What you will learn
This tutorial focuses on the technical side of building a game in Unity, covering the
following:
Character Controllers
Projectors
Audio Listeners, Audio Sources & Audio Clips
Multiple Cameras (and how to switch between them)
UnityGUI scripting system
Colliders
Messages & events
741441649.002.png
Zgłoś jeśli naruszono regulamin