PacktLib: Unity 3.x Game Development by Example Beginner's Guide

Unity 3.x Game Development by Example

Credits

About the Author

About the Reviewer

www.PacktPub.com

Preface

That's One Fancy Hammer!

Introducing Unity 3D

Unity takes over the world

Browser-based 3D? Welcome to the future

Time for action – Install the Unity Web Player

Welcome to Unity 3D!

Walk before you can run (or double jump)

There's no such thing as "finished"

Stop! Hammer time

The wonders of technology!

The Scene window

Don't stop there—live a little!

Summary

Let's Start with the Sky

That little lightbulb

The siren song of 3D

Features versus content

A game with no features

Mechanic versus skin

Trapped in your own skin

That singular piece of joy

One percent inspiration

Motherload

Heads up!

Artillery Live!

Pong

The mechanic that launched a thousand games

Toy or story

Redefining the sky

Summary

Game 1: Ticker Taker

Kick up a new Unity project

'Tis volley

Keep the dream alive

Slash and burn!

The many faces of keep-up

Creating the ball and the hitter

Time for action – Creating the ball

A ball by any other name

Time for action – Renaming the ball

Origin story

Time for action – Moving the ball Into the "sky"

Time for action – Shrinking the ball

Time for action – Saving your scene

Time for action – Adding the paddle

Keeping yourself in the dark

Time for action – Adding a light

Time for action – Moving and rotating the light

Are you a luminary?

Time for action – Camera mania

Time for action – Test your game

Let's get physical

Time for action – Adding physics to your game

Understanding the gravity of the situation

More bounce to the ounce

Time for action – Make the ball bouncy

Summary

Code Comfort

What is code?

Time for action – Writing your first Unity script

A leap of faith

Lick it and stick it

It's all Greek to me

You'll never go hungry again

With great sandwich comes great responsibility

Examining the code

Time for action – Find the Mesh Renderer component

Time for action – Make the ball re-appear

Ding!

Time for action – Journey to the Unity Script Reference

The Renderer class

What's another word for "huh"?

It's been fun

Time for action – Unstick the script

Gone, but not forgotten

Why code?

Equip your baby bird

Time for action – Creating a new MouseFollow script

A capital idea

Animating with code

Time for action – Animating the paddle

Pick a word—(almost) any word

Screen coordinates versus world coordinates

Move the paddle

Worst. Game. Ever.

See the matrix

Time for action – Listening to the paddle

A tiny bit o' math

Tracking the numbers

Futzing with the numbers

Time for action – Logging the new number

She's A-Work!

Somebody get me a bucket

Time for action – Declaring a variable to store the screen midpoint

Using all three dees

Time for action – Following the Y position of the mouse

A keep-up game for robots

Once more into the breach

Time for action – Re-visiting the Unity Language Reference

Our work here is done

Time for action – Adding the sample code to your script

One final tweak

Educated guesses

Right on target

Keep it up

Game #2: Robot Repair

You'll totally flip

A blank slate

You're making a scene

Time for action – Setting up two scenes

No right answer

Time for action – Preparing the GUI

The beat of your own drum

Time for action – Creating and linking a custom GUI skin

Time for action – Creating a button UI control

Want font?

Cover your assets

Time for action – Nix the mip-mapping

Front and center

Time for action – Centering the button

To the game!

Time for action – Adding both scenes to the Build List

Set the stage for robots

Time for action – Preparing the game scene

The game plan

Have some class!

Time for action – Storing the essentials

Start me up

Going loopy

The anatomy of a loop

To nest is best

Seeing is believing

Time for action – Creating an area to store the grid

Build that grid

Now you're playing with power!

Game #2: Robot Repair Part 2

From zero to game in one chapter

Finding your center

Time for action – Centering the game grid vertically

Time for action – Centering the game grid horizontally

Down to the nitty griddy

Time for action – Preparing to build the deck

Time for action – Building the deck

Time for action – Modifying the img argument

What exactly is "this"?

Random reigns supreme

Second dragon down

Time to totally flip

Time for action – Making the cards two-sided

Time for action – Building the card-flipping function

Time for action – Building the card-flipping function

Pumpkin eater

Stabby McDragonpoker rides again

Game and match

Time for action – ID the cards

Time for action – Comparing the IDs

On to the final boss

Time for action – Checking for victory

Bring. It. On.

Don't Be a Clock Blocker

Apply pressure

Time for action – Preparing the clock script

Time for more action – Preparing the clock text

Still time for action – Changing the clock text color

Time for action rides again – Creating a font texture and material

Time for action – What's with the tiny font?

Time for action – Preparing the clock code

Time for action – Creating the countdown logic

Time for action – Displaying the time onscreen

Picture it

Time for action – Grabbing the picture clock graphics

Time for action – Flexing those GUI muscles

The incredible shrinking clock

Keep your fork—there's pie!

How they did it

Time for action – Rigging up the textures

Time for action – Writing the pie chart script

Time for action – Commencing operation pie clock

Time for action – Positioning and scaling the clock

Unfinished business

Ticker Taker

Welcome to Snoozeville

Time for action – Exploring the models

Time for action – Hands up!

Time for action – Changing the FBX import scale settings

Time for action – Making the mesh colliders convex

Time for action – Making the hands and tray follow the mouse

Time for action – Get your heart on

Time for action – Ditch the ball and paddle

Time for action – Material witness

This just in: this game blows

Time for action – Multiple erections

Time for action – Creating a font texture

Time for action – Creating the HeartBounce script

Time for action – Tagging the tray

Time for action –Tweak the bounce

Time for action – Keeping track of the bounces

Time for action – Adding the lose condition

Time for action – Adding the Play Again button

Game #3: The Break-Up

Time for action – Bombs away!

Time for action – Poke those particles

Time for action – Creating a spark material

Time for action – Prefabulous

Time for action – Lights, camera, apartment

Time for action – Adding the character

Time for action – Registering the animations

Time for action – Scripting the character

Time for action – Opening the pod bay door, Hal

Time for action – Collision-enable the character

Time for action – Re-prefab the prefab

Time for action – Apocalypse now?

Time for action – Go boom

Time for action – The point of impact

Time for action – Hook up the explosion

Summary

Game #3: The Break-Up Part 2

Time for action – Amass some glass

Time for action – Creating a Particle System

Time for action – Making it edgier!

Time for action – Containing the explosion

Time for action – Let's get lazy

Very variable?

Terminal velocity is a myth—bombs fall faster

Time for action – Tagging the objects

Time for action – Writing the collision detection code

Time for action – Animation interrupts

Time for action – Adding facial explosions

Time for action – Making some noise

Time for action – Adding sounds to the FallingObjectScript

What's the catch?

Time for action – Mixing it up a bit

Summary

Game #4: Shoot the Moon

Time for action – Duplicating your game project

Time for action – Spacing this sucker up a bit

Time for action – Enter the hero

Time for action – It's a hit!

Time for action – Bring on the bad guys

Time for action – Do some housekeeping

Time for action – Fixing the fall

Time for action – Tweak the hero

Time for action – Give up the func

Time for action – Itchy trigger finger

Time for action – Futurize the bullet

Time for action – Building Halo

Time for action – Fire!

Time for action – Code do-si-do

Time for action – The maaagic of aaaarguments

Time for action – Adding the most important part of any space shooter

Summary

More hospitality

Action!

Open heart surgery

Time for action – Haul in the hallway

Time for action – Meet me at camera two

Time for action – Adjusting the Main Camera

Time for action – Deck the halls

Time for action – Turn on the lights

Time for action – Setting up the camera rig

Time for action – Animating the bouncer

Time for action – I like to move it, move it

Time for action – Animating the runner

Time for action – How to "handle" Nurse Slipperfoot

Time for action – You spin me right round

Time for action – Deploying your game

Time to grow

Beyond the book

References

References

References

References

References

References

Index