gamecamp! and game dev @ davis introduction to unity®

31
GameCamp! and Game Dev @ Davis Introduction to Unity®

Upload: blake-singleton

Post on 19-Dec-2015

233 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: GameCamp! and Game Dev @ Davis Introduction to Unity®

GameCamp! andGame Dev @ DavisIntroduction to Unity®

Page 2: GameCamp! and Game Dev @ Davis Introduction to Unity®

Launch Unity®

Page 3: GameCamp! and Game Dev @ Davis Introduction to Unity®

Create New 3D Project

Page 4: GameCamp! and Game Dev @ Davis Introduction to Unity®

Unity® Interface

Page 5: GameCamp! and Game Dev @ Davis Introduction to Unity®

Empty SceneDelete main camera and directional light in the Hierarchy View so that there is nothing in the object hierarchy.

Page 6: GameCamp! and Game Dev @ Davis Introduction to Unity®

Create Terrain▼Game Object

►Create► 3D Object

►Terrain

Page 7: GameCamp! and Game Dev @ Davis Introduction to Unity®

Center the Terrain▼Terrain Inspector

►Transform►Positionx = -1000

y = 0z = -1000

Page 8: GameCamp! and Game Dev @ Davis Introduction to Unity®

Navigate to TerrainUsing the navigation tools, navigate to find the terrain in Scene View

Page 9: GameCamp! and Game Dev @ Davis Introduction to Unity®

Add a LightAdd directional light▼Hierarchy

►Create ► Light

►Directional Light

Page 10: GameCamp! and Game Dev @ Davis Introduction to Unity®

Make the Terrain PrettyImport terrain assets▼Assets

►Right Click - Import Package►Environment

►Import All

Page 11: GameCamp! and Game Dev @ Davis Introduction to Unity®

Make the Terrain PrettyClick on terrain In the inspector click the

paintbrush in the middle▼Edit Textures

►Add TextureChoose any textureSet X & Y size = 1

Page 12: GameCamp! and Game Dev @ Davis Introduction to Unity®

Create Character ControllerImport character controller assets▼Assets

►Import package►Characters

►Import allIn your project view, drag a first person controller from Assets/Standard Assets/Character/FPS Character/Prefabs/FPSController to the Scene View (shown on next slide)

Page 13: GameCamp! and Game Dev @ Davis Introduction to Unity®

Character Controller

Page 14: GameCamp! and Game Dev @ Davis Introduction to Unity®

TestRun the game to see what happens

Page 15: GameCamp! and Game Dev @ Davis Introduction to Unity®

Add Features to TerrainAdd topology▼Terrain Inspector

►Raise/Lower Terrain button (Leftmost button)►Choose any brush

Draw on terrain to make mountains►Smooth height button (3rd from left)

►Choose any brushDraw on terrain to smooth mountains

Page 16: GameCamp! and Game Dev @ Davis Introduction to Unity®

Move Character ControllerMove Character Controller above terrain▼Select First Person Controller (either in Hierarchy or

Scene view)►Press “W” to allow object to be translated

►Drag yellow/green arrow upwards in Scene View to make sure First Person Controller is above the terrain.

Page 17: GameCamp! and Game Dev @ Davis Introduction to Unity®

TestRun the game to see what happens

Page 18: GameCamp! and Game Dev @ Davis Introduction to Unity®

Create a Tree PrefabIn Project View, go to Assets/Standard Assets/Environment/Speed Tree/Palm and drag “Palm_Desktop” into the hierarchy

Page 19: GameCamp! and Game Dev @ Davis Introduction to Unity®

Create a Tree PrefabAdd a capsule collider to palm tree▼Palm Tree Inspector

►Add Component►Physics

►Capsule Collider

Page 20: GameCamp! and Game Dev @ Davis Introduction to Unity®

Create a Tree PrefabModify capsule collider▼Palm Tree Inspector

►Capsule Collider►Center

X = 0, Z = 0►Radius

0.4

Page 21: GameCamp! and Game Dev @ Davis Introduction to Unity®

Create a Tree PrefabRename your palm to “Palm 2”

Drag Palm 2 from the Hierarchy View to the Project View’s main directory (“Assets”)

Page 22: GameCamp! and Game Dev @ Davis Introduction to Unity®

Palm Tree

Page 23: GameCamp! and Game Dev @ Davis Introduction to Unity®

Add Features to TerrainUse the Tree tool in the Terrain’s terrain component

▼Trees button (3rd from right)►Edit trees

►Add Tree►Tree

►Choose “Palm 2”►Add

►Mass Place Trees►Place

Page 24: GameCamp! and Game Dev @ Davis Introduction to Unity®

Trees!

Page 25: GameCamp! and Game Dev @ Davis Introduction to Unity®

TestRun the game to see what happens

Page 26: GameCamp! and Game Dev @ Davis Introduction to Unity®

Prepare External Script Editor

Unity® Menu/File Menu -> Preference -> External Tools -> External Script Editor:

Make sure it is set to MonoDevelop

Page 27: GameCamp! and Game Dev @ Davis Introduction to Unity®

Rocket LauncherCreate a new script for Controller (RocketLauncher) and add as component to FPSController

Replace the void update function call with:

http://pastebin.com/nWYwxJiS

Page 28: GameCamp! and Game Dev @ Davis Introduction to Unity®

Finished Scene

Page 29: GameCamp! and Game Dev @ Davis Introduction to Unity®

Play!Hit the “Play” button● WASD to move● Right Click to “load” rocket launcher”● Left Click to fire

Page 30: GameCamp! and Game Dev @ Davis Introduction to Unity®

Gameplay

Page 31: GameCamp! and Game Dev @ Davis Introduction to Unity®

Extra● Switch values in the FPSController● Make changes to the terrain and the

terrain/tree colliders