资源说明:Unity3d 游戏开发教程
Preface 1
Project One: Develop a Sprite and Platform Game 9
Mission briefing 9 Creating a camera and a level 11 Creating a 2D character 20 Creating CharacterControl class and SpriteManager class 25 Jumping and physics 33 Creating a key and door 40 Adding a sound and replay button 44 Game over-Wrapping it up 49 Are you ready to go gung ho? A Hotshot challenge 50
Project Two: Create a Menu for an RPG Game—Add Powerups, Weapons,
and Armor 51 Mission briefing 51 Custom skin with GUI Skin 54 Creating a menu object 70 Creating a status tab 76 Creating an inventory tab 82 Creating an equipment tab 88 Game over-Wrapping it up 98 Are you ready to go gung ho? A Hotshot challenge 99
Project Three: Model and Shade your Hero/Heroine 101
Mission briefing 102 Exporting from 3D Studio Max 106 Shader programming—Diffuse and bump (normal) map 112 Shader programming—Ambient and specular light 124 Shader programming—Rim light and toon ramp 130

Table of Contents
Game over-Wrapping it up 136 Are you ready to go gung ho? A Hotshot challenge 137
Project Four: Add Character Control and Animation to your Hero/Heroine 139
Mission briefing 139 Setting up character animation and level 141 Creating the character controller and built-in script 151 Creating a custom character control script 155 Creating CrossFade animation 162 Creating a third-person camera to follow our character 166 Game over-Wrapping it up 171 Are you ready to go gung ho? A Hotshot challenge 172
Project Five: Build a Rocket Launcher! 173
Mission briefing 173 Setting up the character with the first-person controller prefab 175 Creating the New3PSController and MouseLook_JS scripts 182 Creating the rocket launcher and scope target 191 Creating the rockets and particles 196 Creating the rocket bullet UI 205 Game over-Wrapping it up 208 Are you ready to go gung ho? A Hotshot challenge 210
Project Six: Create Smart AI 211
Mission briefing 212 Creating the waypoint and gizmos 215 Creating an enemy AI 226 Creating the enemy movement with AIController script 229 Creating a hit-point UI 243 Game over-Wrapping it up 247 Are you ready to go gung ho? A Hotshot challenge 249
Project Seven: Forge a Destructible and Interactive Virtual World 251
Mission briefing 252 Optimizing the AIController script 254 Creating a ragdoll 261 Creating a destructible wall 270 Creating a rockslide and trigger area 275 Game over-Wrapping it up 281 Are you ready to go gung ho? A Hotshot challenge 284
ii

Table of Contents
Project Eight: Let the World See the Carnage! Save, Load, and
Post High Scores 285 Mission briefing 285 Creating a high score menu 288 Saving and loading the local high score 295 Getting XML data from the server 306 Posting and loading high scores to the server 312 Game over-Wrapping it up 321 Are you ready to go gung ho? A Hotshot challenge 322
Appendix A: Important Functions 323
Awake 323 Start 324 Update 324 FixedUpdate 324 LateUpdate 325 OnGUI 325 OnDrawGizmos 326
Appendix B: Coroutines and Yield 329
YieldInstruction 329 WaitForSeconds 330 WaitForFixedUpdate 331 Coroutine 332 StartCoroutine 333 StopCoroutine 335 StopAllCoroutines 336
Appendix C: Major Differences between C# and Unity JavaScript 339
Unity Script Directives 339 Type names 340 Variable declaration 340 Variable with Dynamic Type 341 Resolution 341 Multi-dimensional array declaration 341 Character literals not supported 341 Class declarations 342 Limited interface support 343 Generics 343 The foreach keyword 344 The new keyword 345
iii

Table of Contents
YieldInstruction and coroutine 345 Casting 346 Properties with getters/setters 347 Changing Struct properties by value VS by reference 348 Function/method definitions 348 Reference 349
Appendix D: Shaders and Cg/HLSL Programming 351
ShaderLab properties 352 Surface shaders 353 Cg/HLSL programming 358 Reference 360
Index 361
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。