万本电子书0元读

万本电子书0元读

顶部广告

Unity 3.x Game Development Essentials电子书

售       价:¥

3人正在读 | 0人评论 9.8

作       者:Will Goldstone

出  版  社:Packt Publishing

出版时间:2011-12-20

字       数:1065.5万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
This book follows an informal, demystifying approach to the world of game development with the Unity game engine. With no prior knowledge of game development or 3D required, you will learn from scratch, taking each concept at a time working up to a full 3D mini-game. You'll learn *ing with C# or JavaScript and master the Unity development environment with easy-to-follow stepwise tasks. If you’re a designer or animator who wishes to take their first steps into game development or prototyping, or if you’ve simply spent many hours sitting in front of video games, with ideas bubbling away in the back of your mind, Unity and this book should be your starting point. No prior knowledge of game production is required, inviting you to simply bring with you a passion for making great games.
目录展开

Unity 3.xGame Development Essentials

Table of Contents

Unity 3.x Game Development Essentials

Credits

Foreword

About the Author

About the Reviewers

www.PacktPub.com

Support files, eBooks, discount offers and more

Why Subscribe?

Free Access for Packt account holders

Preface

What this book covers

What you need for this book

Who this book is for

Getting help with the book and updates

Conventions

Reader feedback

Customer support

Downloading the book asset bundle

Downloading the color images of this book

Errata

Piracy

Questions

1. Enter the Third Dimension

Getting to grips with 3D

Coordinates

Local space versus world space

Vectors

Cameras

Projection mode—3D versus 2D

Polygons, edges, vertices, and meshes

Materials, textures, and shaders

Rigidbody physics

Collision detection

Essential Unity concepts

The Unity way—an example

Assets

Scenes

GameObjects

Components

Scripts

Prefabs

The interface

The Scene view and Hierarchy

Control tools

Flythrough Scene navigation

Control bar

Search box

Create button

The Inspector

The Project window

The Game view

Summary

2. Prototyping and Scripting Basics

Your first Unity project

A basic prototyping environment

Setting the scene

Adding simple lighting

Another brick in the wall

Building the master brick

And snap!—It's a row

Grouping and duplicating with empty objects

Build it up, knock it down!

Setting the viewpoint

Introducing scripting

A new behaviour script or 'class'

What's inside a new C# behaviour

Basic functions

Variables in C#

What's inside a new Javascript behaviour

Variables in Javascript

Comments

Wall attack

Declaring public variables

Assigning scripts to objects

Moving the camera

Local, private, and public variables

Local variables and receiving input

Understanding Translate

Implementing Translate

Testing the game so far

Making a projectile

Creating the projectile prefab

Creating and applying a material

Adding physics with a Rigidbody

Storing with prefabs

Firing the projectile

Using Instantiate() to spawn objects

Adding a force to the Rigidbody

Summary

3. Creating the Environment

Designing the game

Using the terrain editor

Terrain menu features

Importing and exporting heightmaps

Setting the resolution

Mass place trees

Flatten Heightmap

Refresh tree and detail prototypes

The terrain toolset

Terrain Script

Raise height

Paint height

Smooth Height

Paint Texture

Place Trees

Paint Details

Terrain Settings

Creating the island—sun, sea, and sand

Step 1—Setting up the terrain

Step 2—Creating the Island outline

Step 3—Volcano!

Step 4—Adding textures

Painting procedure

Sandy areas

Grass & Rock

Volcanoes rock!

Step 5—Tree time

Step 6—The grass is always greener

Step 7—Let there be lights!

Creating sunlight

Step 8—What's that sound?

Sounds—2D versus 3D

Audio file formats

The hills are alive!

Importing the book's asset package

Further audio settings

Step 9—Look, there! Up in the skybox!

Step 10—Open water

Step 11—Going walkabout

Step 12—Final tweaks

Summary

4. Player Characters and Further Scripting

Working with the Inspector

Tags

Layers

Prefabs and the Inspector

Anatomy of a character

Deconstructing the First Person Controller object

Parent-child issues

First Person Controller object

Object 1: First Person Controller (parent)

Transform

Character Controller

Mouse Look (Script)

Character Motor (Script)

FPSInput Controller (Script)

Object 2: Graphics (child)

Mesh filter

Mesh Renderer

Object 3: Main Camera (child)

Camera

GUILayer and Flare Layer

Mouse Look (Script)

Audio listener

Further scripting

Commands

Variables

Variable data types

Using variables

Public versus private variables

Declaring public and private variables

Full example

Functions

Update()

OnMouseDown()

Writing custom functions

Return type

Arguments

Declaring a custom function

Calling a custom function

If else statements

C#:

Multiple conditions

For loops

Inter-script communication and Dot Syntax

Accessing other objects

Find() and FindWithTag()

SendMessage

GetComponent

Programming for Mobile

Dot Syntax

Comments

Further reading

Scripting for character movement

Deconstructing the script

Full script (Javascript)

Variable declaration

Storing movement information

Moving the character

Checking grounded

@Script commands

Summary

5. Interactions

External modeling applications

Common settings for models

Meshes

Normals and Tangents

Materials

Animations

Animation Compression

Setting up the outpost model

Adding the outpost

Positioning

Rotation

Adding colliders

Adding the Rigidbody

Adding audio

Disabling automatic animation

Collisions and triggers

Ray casting

The frame miss

Predictive collision detection

Opening the outpost

Approach 1—Collision detection

Creating new assets

Scripting for character collision detection

Working with OnControllerColliderHit

OpenDoor() custom function

Declaring the function

Checking door status

Playing audio

Testing the script

Extending colliders

Playing animation

Reversing the procedure

Code maintainability

Drawbacks of collision detection

Approach 2—Ray casting

Disabling collision detection with comments

Migrating code—writing a DoorManager script

Tidying PlayerCollisions

Casting the ray

Resetting the collider

Approach 3—Trigger collision detection

Creating and scaling the trigger zone

Scripting for trigger collisions

Removing PlayerCollisions

Summary

6. Collection, Inventory, and HUD

Creating the power cell prefab

Downloading, importing, and placing

Tagging the power cell

Collider scaling and rotation

Enlarging the power cell

Adding a trigger collider

Collider scale

Adding the Rigidbody

Creating the power cell script

Adding rotation

Adding Trigger Collision Detection

Saving as a prefab

Scattering power cells

Writing the Player Inventory

Saving the charge value

Setting the variable start value

Audio feedback

Adding the CellPickup() function

Adding the Inventory to the player

Restricting outpost access

Restricting door access with a cell counter

Displaying the power cell HUD

Import settings for GUI textures

Creating the GUITexture object

Positioning the PowerGUI texture

Scripting for texture swap

Understanding arrays

Adding the HUD array

Assigning textures to the array

Disabling the HUD for game start

Enabling the HUD during runtime

Adding the power generator

Signifying door unlock

Adding the locked light

Switching lights and removing the HUD

Hints for the player

Writing on screen with GUIText

Scripting for GUIText control

Adjusting hints to show progress

Using fonts

Summary

7. Instantiation and Rigidbodies

Utilizing instantiation

Rigidbodies

Forces

The Rigidbody component

Making the mini-game

Creating the coconut prefab

Creating the textured coconut

Adding physics

Saving as a prefab

Creating the Launcher object

Scripting to throw coconuts

Checking for player input

Playing feedback sound

Instantiating the coconut

Naming instances

Assigning velocity

Adding development safeguards

Ensuring component presence

Safeguarding collisions

Using IgnoreCollision() code

Ignoring collisions with layers

Including the Audio Source component

Final checks

Instantiate restriction and object tidying

Activating coconut throw

Writing the throwing mat trigger script

Adding the coconut shy shack

Import settings

Creating the throwing mat trigger

Removing coconuts

Targets and coconut collisions

Placement

Disabling automatic animation

Adding Rigidbodies to moving parts

Writing the Coconut collision detection script

Establishing variables

Collision detection

Using co-routines to time game elements

Including the Audio Source component

Assigning the script

Creating more targets

Winning the game

Setting up variables

Checking for a win

Script assignment

Incrementing and decrementing target count

Adding to the target count

Subtracting from the target count

Finishing touches

Adding the crosshair

Toggling the crosshair GUI Texture

Informing the player

Summary

8. Particle Systems

What is a particle system?

Particle Emitter

Particle Animator

Particle Renderer

Creating the task

Assets involved

Adding the log pile

Creating the campfire particle systems

Creating fire

Ellipsoid Particle Emitter settings

Particle Animator settings

Particle Renderer settings

Adding a material

Positioning the FireSystem

Time to Test!

Blowing smoke!

Ellipsoid Particle Emitter settings

Particle Animator settings

Particle Renderer settings

Positioning

Adding audio to the fire

3D Audio

Lighting the fire

Adding the matches

Writing the Match Collection script

Creating the matches GUI

Collecting the matches

Starting the fire

Using arrays and loops for commands on multiple objects

Signifying Inventory usage

Testing and confirming

So, what's the problem?

Safeguarding with additional conditions

Summary

9. Designing Menus

Interfaces and menus

Creating the scene

Duplicating the island

Grouping the environment objects

Duplicating the scene

Framing the shot

Preparing textures for GUI usage

Adding the game title

GUITexture formats

Creating the GUITexture object

Positioning

Creating the menu with GUITextures and mouse events

Adding the play button

GUITexture button script

Loading scenes

Assigning public variables

Testing the button

Adding the instructions button

Adding the quit button

Checking scripts with Debug commands

Creating the menu with the Unity GUI class and GUI skins

Disabling game objects

Creating the menu

Creating public variables

The OnGUI() function

Positioning for GUIs

Pixel-specific positioning

Styling GUI buttons with a GUI skin

Using textures for GUI button backgrounds

Choosing font size for GUI buttons

Resolution-independent positioning

Scripting button actions

Adding the Instructions page

Creating menu pages

Formatting the GUI label with the GUI skin asset

A note on optimizing the loading process

Summary

10. Animation Basics

Game win sequence

Win sequence approach

Triggering the win

Creating the game win messages

Positioning win sequence GUI elements

Grouping GUITextures for optimized instantiation

Animating with linear interpolation (Lerp)

Adjusting animations

Storing the win sequence

Creating the win object

Creating the Fader and using the Animation panel

Scaling for various resolutions

Starting the Fader from invisibility

Animation panel overview

Creating an animation clip

Creating keyframes

Using animation curves

Adding animation events

Creating and animating the Loading GUI

Loading scenes with animation events

Storing and instantiating the Loading GUI

Loading the win sequence

Layering GUITextures

Challenge—fading in the Island scene

Summary

11. Performance Tweaks and Finishing Touches

Terrain tweaks and player position

Tweaking the terrain

Positioning trees

Hills, troughs, and texture blending

Life's a beach

Keep on the right path

Positioning the player

Optimizing performance

Camera Clip Planes and Fog

Lightmapping

Lighting and baking the island

Preparing for lightmapping

The outpost and generator

Lighting inside the outpost

Lighting a mesh with a Self Illuminated shader

Lighting inside with Baked-Only Point Lights

The coconut shy

The campfire

Baking the lightmap

Lightmapping overview

Ambient lighting

Including lights

Excluding from the bake

Baking the scene

Restoring dynamic objects

Finishing touches

Volcano!

Positioning the particle system

Required assets

Making the smoke material

Particle system settings

Ellipsoid Particle Emitter settings

Particle Animator settings

Adding audio to the volcano

Volcano testing

Coconut trails

Editing the Prefab

Trail Renderer component

Updating the prefab

Summary

12. Building and Sharing

Build options

Web Player

Web Player Streamed

PC or Mac standalone

OSX Dashboard Widget

Build Settings

Player Settings

Cross-Platform Settings

Per-Platform Settings

Resolution and Presentation

Web Player Settings

Standalone Settings

Icon

Standalone

Splash Image

Standalone

Other Settings

Web Player

Standalone

Quality Settings

Player Input settings

Building the game

Adapting for web build

Quit button platform automation

Preparing for streaming

Displaying streamed loading progress

Styling the loading info box

First Build

Building the Standalone

Free versus Pro

Building for the Web

Embedding web player builds in your own site

The <head>—web JavaScript

Making the <head> code portable

Object embedding from the <BODY>

Styling your Unity embed with CSS

Sharing your work

Sharing on Kongregate.com

Summary

13. Testing and Further Study

Learn by doing

Testing and finalizing

Public testing

Frame rate feedback

Optimizing performance

Approaches to learning

Cover as many bases as possible

Don't reinvent the wheel

If you don't know, just ask!

Summary

Index

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部