First Person Shooter Project

Slides:



Advertisements
Similar presentations
INNER WORKINGS OF UNITY 3D. WHAT WE ARE GOING TO COVER Intro to Unity Physics & Game Objects Cameras & Lighting Textures & Materials Quaternions and Rotation.
Advertisements

Unity Overview Using Unity 3.5 (Free version) [1]:
GameCamp! and Game Davis Introduction to Unity®
GameCamp! and Game Davis Creating a 2D Platformer in Unity.
GameCamp! and Game Davis Introduction to Scripting in Unity®
HELLO WORLD: YOUR FIRST PROGRAM CHAPTER Topics  Hello World?  Creating a Unity Project –The Unity Project Folder  MonoDevelop: Unity's Code Editor.
Based on Roll-a-ball video tutorial from Unity Technologies Part WakeUpAndCode.com.
Unity 3D game IDE 1.  Unity is a multi-platform, integrated IDE for scripting games, and working with 3D virtual worlds  Including:  Game engine ▪
SE 350 – Programming Games Lecture 6: Programming with Unity Lecturer: Gazihan Alankuş Please look at the last slide for assignments (marked with TODO)
David, on using MonoDevelop David, on getting to edit and debug in Visual Studio.
Derived from Kirill Muzykov’s Rocket Mouse Tutorial WakeUpAndCode.com.
EEC-693/793 Applied Computer Vision with Depth Cameras Lecture 13 Wenbing Zhao
SE 350 – Programming Games Lecture 7: Programming with Unity Lecturer: Gazihan Alankuş Please look at the last slide for assignments (marked with TODO)
Web Games Programming An Introduction to Unity 3D.
Web Games Programming Unity Scripting Fundamentals.
UFCFS D Technologies for the Web Unity 3D: Review of Topics and Related Concepts.
Unity 5 Visual Studio Code * Asset Store * FPS * Terrain.
Learning Unity. Getting Unity
SE 320 – Introduction to Game Development Lecture 3: Unity’s Interface and Concepts Lecturer: Gazihan Alankuş Please look at the last two slides for assignments.
SE 320 – Introduction to Game Development Lecture 7: Programming Lecturer: Gazihan Alankuş Please look at the last two slides for assignments (marked with.
UFCEK-20-3Web Games Programming Unity 3D: Review of Topics Publishing for the Web.
Derived from Kirill Muzykov’s Rocket Mouse Tutorial WakeUpAndCode.com.
Problem Solving Methodology Rachel Gauci. Problem Solving Methodology Development Design Analysis Evaluation Solution requirements and constraints. Scope.
Derived from Kirill Muzykov’s Rocket Mouse Tutorial WakeUpAndCode.com.
CLASSES CHAPTER Topics  Understanding Classes –The Anatomy of a Class  Class Inheritance –Superclasses and Subclasses –Virtual and Override 2.
GameDevClub CODE CHEAT SHEET NOTE: ALL OF THE CODE IS CASE-SENSITIVE AND THE SYNTAX IS STRICT SO A LOT OF YOUR ERRORS WILL PROBABLY COME FROM TYPOS If.
UFCEKU-20-3Web Games Programming Instantiating World Objects.
Yingcai Xiao Event-driven Programming in Game Development Yingcai Xiao.
UFCFSU-30-13D Technologies for the Web An Introduction to Unity 3D.
Expressive Intelligence Studio // Center for Games and Playable Media // Unity Pro John Murray Expressive.
INTRO TO UNITY Building your first 3D game. DISCLAIMER  “This website is not affiliated with, maintained, endorsed or sponsored by Unity Technologies.
Yingcai Xiao Game Development with Unity3D Inside/Outside Unity3D.
Angry Teapots– using the physics engine in Unity Peter Passmore.
Game Development with Unity3D
Thanks to our Sponsors! Community Sponsor Yearly Sponsor
Advanced 3D Game Project
EEC-693/793 Applied Computer Vision with Depth Cameras
Quick Intro to Unity Lecture 2.
Game Development with Unity3D Inside/Outside Unity3D
3GB3 Game Design Unity 3D Basics.
More (C#) Scripting Day 2, Lesson 1.
EEC-693/793 Applied Computer Vision with Depth Cameras
Game Development Unity3D.
EEC-693/793 Applied Computer Vision with Depth Cameras
How to Import Audio in Adobe Flash
lecture 8 Our First Project
Event-driven Programming
Oculus Rift DK2 + Leap Motion Unity Tutorial
A Prime Example of HCI Application
Lecture 3 Richard Gesick
lecture 7 Our First Project
Create a Simple UI Game in 10 Steps
A beginner’s tutorial for Unity and VR
Week 6: Time and triggers!
Introduction to Unity 2D Game Development
Myo + Oculus Rift Tutorial
Fundaments of Game Design
Unity Terrain Design Tutorial
Fundaments of Game Design
EEC-693/793 Applied Computer Vision with Depth Cameras
Deeper into the Depths: Casting, Scope, Gizmos, Layers, Self-Destruct.
Cosc 5/4735 Unity and Cardboard VR.
Unity Game Development
Unity Game Development
Unity Game Development
Unity Game Development
Unity Game Development
Advanced 3D Art and Animation
Presentation transcript:

First Person Shooter Project Unity3D Tutorial First Person Shooter Project

2D Game 변환 2D Space Shooter 이용하여 3D 게임으로 변환 Main Camera Position: 0,0,5; Rotation: 0,0,0; Projection: Perspective Background Position: 0,0,16; Rotation: 0,0,0; Scale: 30,30,0;

FPS Project First Person Shooter Project 게임 환경 제작 Game Object와 Material를 이용한 자체 제작 Asset Store를 이용한 게임환경 제작 Character Controller 적용 Script를 이용한 Shooting 게임 GUI 구성

Game World 제작 준비 Game World 제작 File Menu  Open Project “FPS3D” Download 3DGameTemplate Asset Import Package  Characters & ParticleSystems Open “1_Start.unity” Import Packages > Characters Import Packages > ParticleSystems

Asset Store에서 Asset 가져오기 Select Window  Asset Store Select Categories  Texture & Materials  Metal Select Top Free  “Yughues Free Metal materials” Download & Import

Character Controller Character Controller 사용 Delete Camera 1인칭 컨트롤러 추가 방법 Standard Assets > Characters > FirstPersonCharacter 선택 프로젝트 뷰에서 Prefabs> “FPSController” 드래그하여 씬뷰에 가져다 놓음 (캡슐 생김) Rename “Player” & Select Tag “Player” FirstPersonCharacter  Add Component “GUI Layer” 2_Add_FirstPersonCharacter.unity 기존 Camera 제거

Shooting using C# Script Create Empty Object “Launcher” Drag the Launcher object onto “FirstPersonCharacter” object that belongs to the FPS Controller in the Hierarchy panel Create Bullets Using Prefabs Create Bullets Create > 3D Object > Sphere “MyBullet”  scale 0.2 Attach a rigid body component to the “MyBullet” Component > Physics > RigidBody Create “Prefabs” Create New Prefab “MyBullet” drag and drop the bullet game object from the Hierarchy window onto the bullet prefab in the Project window Delete the bullet game object in the Hierarchy window.

Shooting using C# Script Launcher로부터 총알(Bullet) 발사 Select “Launcher” Object Create C# Script “createMyBullet” Add Component > New script Open MonoDevelop “Bullet” is assigned to the prefab Bullet variable in the script using UnityEngine; using System.Collections; public class CreateMyBullet : MonoBehaviour { public Rigidbody prefabBullet; public float bulletForce = 1000.0f; void Update() { if (Input.GetButtonDown("Fire1")) { // 총알 오브젝트(InstanceBullet) 생성 Rigidbody instanceBullet = Instantiate(prefabBullet, transform.position, transform.rotation) as Rigidbody; instanceBullet.AddForce(transform.forward * bulletForce); // 총알 오브젝트 앞으로 발사하는 힘 추가 Physics.IgnoreCollision ( instanceBullet.GetComponent<Collider>(),transform.root.GetComponent<Collider>() ); // Player의 Collider 와의 충돌 무시 } 3_Launcher.unity

Explosion Add Explosion Effect 충돌 파티클 생성 Select MyBullet Add C# Script “MyProjectile” & Open MonoDevelop Import Standard Assets  ParticleSystems Select “Explosion” prefab  Drag & Drop “Explosion” variable using UnityEngine; using System.Collections; public class MyProjectile : MonoBehaviour { public GameObject explosion; void OnCollisionEnter( Collision collision) { ContactPoint contact = collision.contacts[0]; // 총알과의 충돌지점 Quaternion rotation = Quaternion.FromToRotation( Vector3.up, contact.normal ); // 충돌지점의 방향 GameObject instantiatedExplosion = Instantiate( explosion, contact.point, rotation ) as GameObject; // 충돌후 폭파(instantiateExplosion) 오브젝트 생성 Destroy(gameObject); // 총알 오브젝트 제거 }

Explosion Destroy explosion prefab 충돌 파티클 제거 Select “Explosion” prefab Add C# Script “ExplosionRemover” & Open MonoDevelop using UnityEngine; using System.Collections; public class MyExplosionRemover : MonoBehaviour { public float explosionTime = 1.0f; void Start () { // 폭파 파티클 1초후 제거 Destroy( gameObject, explosionTime ); } 4_Bullet_Explosion.unity

Make Enemy Objects 총알과의 충돌 오브젝트 (Box) 생성 Create Game Object Cube “MyBox” Attach a rigid body component to the “MyBox” Add Script “Mover” & “Random Rotator” Create Prefab “Box” Select Box in Hierarchy View Drag & Drop the box in Project View

Make Enemy Objects Box 오브젝트 폭파 5_BoxCollsion.unity Select “MyBox”, Add Script “BoxCollsion” Select “explosion_player” prefab using UnityEngine; using System.Collections; public class BoxCollsion : MonoBehaviour { public GameObject explosion; void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Floor") { return; // Floor 와의 충돌은 무시 } if (collision.gameObject.tag == "Player") { Instantiate (explosion, transform.position, transform.rotation); Destroy (gameObject); else { Destory (collsion.gameObject);

Add Sound Import Sound File Shooting Sound Explosion Sound 총알 발사 및 폭파 사운드 추가 Import Sound File Asset store  Catagories  Audio  Sound FX  Weapons Select Top Free Futuristic weapon set Download & Import Shooting Sound Select “Bullet” in Project View Add Component Audio  Audio Source Select Audio Clip “weapon_player” & Check Play On Awake Explosion Sound Select “Explosion” prefab in Project View Select Audio Clip “explosion_enemy” & Check Play On Awake

Score & Health Displaying GUI Using 2DShootingGame “DisplayText”, Check “DisplayText” Select “Player” FirstPersonCharacter  Add Component “GUI Layer” Using 2DShootingGame “GameController” & Check it using UnityEngine; using System.Collections; public class GameController : MonoBehaviour { public GameObject hazard; ----------------중략------------------------------------- public int health=100; void Start () { UpdateHealth (); } public void MinusHealth(int newHealthValue) { health -= newHealthValue; void UpdateHealth() { restartText.text = "Health: " + health;

Score & Health Update score value Select Prefab “Bullet”, Change Script “Projectile” using UnityEngine; using System.Collections; public class Projectile : MonoBehaviour { public GameObject explosion; public int score=10; private GameController gameController; void Start() { GameObject gameControllerObject = GameObject.FindWithTag ("GameController"); if(gameControllerObject != null) { gameController = gameControllerObject.GetComponent<GameController>(); } if(gameController == null) { Debug.Log("Cannot find 'GameController' script"); void OnCollisionEnter(Collision collision) { ----------------중략------------------------------------- if (collision.gameObject.tag == "Floor") { Destroy (gameObject); return; } else { gameController.AddScore (score); Destroy (collision.gameObject); Destroy (gameObject);

Score & Health Update health value Select Prefab “Box”, Change Script “BoxCollsion” using UnityEngine; using System.Collections; public class BoxCollsion : MonoBehaviour { public GameObject explosion; public int healthValue=10; private GameController gameController; void Start() { GameObject gameControllerObject = GameObject.FindWithTag ("GameController"); if(gameControllerObject != null) { gameController = gameControllerObject.GetComponent<GameController>(); } if(gameController == null) { Debug.Log("Cannot find 'GameController' script"); void OnCollisionEnter(Collision collision) { ----------------중략------------------------------------- if (collision.gameObject.tag == "Player") { Instantiate (explosion, transform.position, transform.rotation); gameController.MinusHealth (healthValue); Destroy (gameObject); if (gameController.health == 0) gameController.GameOver ();

FPS Demo Play It!!! Play Other!!!