SlideShare a Scribd company logo
3D GAME APPLICATION BASED ON FIRST PERSON
CONTROLLER
PROJECT REPORT
SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENT FOR
THE DEGREE OF
BACHELOR OF SCIENCE IN COMPUTER SCIENCE
Manonmaniam Sundaranar University
Tirunelveli
Submitted by
ROHITH. G S (15402676)
Under the Guidance of
Mrs. P. GEETHA, MCA, M.E
DEPARTMENT OF COMPUTER SCIENCE
MUSLIM ARTS COLLEGE
THIRUVITHANCODE
2017- 2018
Department of Computer Science
Muslim Arts College, Thiruvithancode
(Affiliated to Manonmaniam Sundaranar University, Tirunelveli)
BONAFIDE CERTIFICATE
This is to certify that the dissertation entitled “3D GAME APPLICATION BASED ON FIRST
PERSON CONTROLLER IN UNITY ENGINE WITH C# AND JAVA SCRIPT” has been
carried out by student ROHITH.GS under my supervision in partial fulfilment of the degree of
Bachelor of science in computer Science department of Manonmaniam Sundaranar University,
Tirunelveli during the academic year of 2017-2018.
Internal Guide
Mrs.P,Geetha,MCA,M.E
Department of Computer Science
Muslim Arts College, Thiruvithancode
Head of Department
Mrs. J. P Medlin Julia, MCA, M. Phil, M.ED
Department of Computer Science
Muslim Arts College, Thiruvithancode
Submitted for Vice-Voice Examination held at Muslim Arts College Thiruvithancode
on …………
External Examiner
1.
2.
DECLARATION
I hereby declare this project entitled “3D GAME APPLICATION BASED ON FIRST
PERSON CONTROLLER” in Muslim Arts College, Thiruvithancode, submitted to
Manonmaniam Sundaranar University partial fulfilment for the partial fulfilment for the
requirement for the award Degree of Bachelor of Science in Computer Science during the
academic year of 2017-2018, under the guidance of Mrs. P. GEETHA, MCA, M.E.
Place: Thiruvithancode Hereby
Date: Rohith G.S
ACKNOWLEDGEMENT
I wish to offer my sincere thanks to our Secretary Lion. H. Mohammad Ali and also to
our beloved principal Prof. Dr. S. Dawn Dharma Roy, Muslim Arts College for permitting me
to do this project work.
I take this opportunity to express my heart full of gratitude to Mrs. J. P. Medlin Julia,
MCA, M.Phil., M.Ed., Head of the Department of Computer Science, Muslim Arts College,
Thiruvithancode, for allow me to do this project with all necessary facilities.
I take this opportunity to express my profound thanks and deep sense of gratitude to
My Guide Mrs. P. Geetha, MCA, M.E, who was behind the scene in every phase providing her
masterly guidance, valuable and timely suggestions and advice which helped me to the project.
I extend my thanks to my parents, programmers and my dear friends for their
cooperation and constant encouragement rendered to make our project successful one.
I also like to thank almighty God, who is the source of Knowledge for helping me, give
strength and support to me to accomplish this work successfully.
With Sincere Thanks,
Rohith G.S
ABSTRACT
I was focusing on developing a “3D GAME APPLICATION BASED ON FIRST
PERSON CONTROLLER”. Including game scenario design, playing method design, game
passed condition, the enemy AI intelligent system logic design and energy system design.
Meanwhile the main implementation technologies of the game are introduced here by the
mainstream Unity3D engine. Practice shows that a picture lifelike realism, movements’ smooth
game works can be efficiently made using the unity3D engine.
Unity game engine is more object-based coding structure to develop this game I use
two scripting languages c# and JavaScript it works as the backend. Mostly I prefer c# as the
first language to study because it is easier to code. The thesis will cover the implementation of
real-time Graphics, Physics Engine, Network support, as well as sound effect and background
music.
DECLARATION
I hereby declare this project entitled “3D GAME APPLICATION BASED ON FIRST
PERSON CONTROLLER” in Muslim Arts College, Thiruvithancode, submitted to
Manonmaniam Sundaranar University partial fulfilment for the partial fulfilment for the
requirement for the award Degree of Bachelor of Science in Computer Science during the
academic year of 2017-2018, under the guidance of Mrs. P. GEETHA, MCA, M.E.
Place: Thiruvithancode Hereby
Date: Rohith G.S
1
1.INTRODUCTION
The project is an implementation of 3D GAME APPLICATION BASED ON FIRST
PERSON CONTROLLER IN UNITY ENGINE WITH C# AND JAVASCRIPT. Making
game is a complicated subject when the big studios create games they do so in large teams
each person has a specific role will that be 3d modelling programming doing concept art by
some design in reality though most people don’t start with a professional while just a single
laptops with good ideas lets at least how I got into it.
Every video games run on what is called a game engine the engine is what tells the
components in the computer stuff like how to render graphics or play audio games such as
half-life 2, counter strike these are run on the source engine but most of the game is common
when it’s came to physics graphics and game play previously these game studios would have
to spend a huge amount of work to creating game engine or purchase an existing one from
other studios which was not cheap but these days a lot of independent engines have been
made with sole purpose of people using them to build his own game .
unity is an engine allow you to create both 2d and 3d games that can be also exported
to variety of platforms. unity is the start up for all the beginner’s because it is not much
complicated .unreal engine is the most advanced game engine for more experienced
developers who are looking to create a good graphical game .
Some requirement for the computer where given from the beginning, such as:
3D graphics –the game must contain 3d models and render these in the game .3D
environments where never a requirement and platform game with the 2D environment could
still open up for 3D objects.
Impressive result – the game result must impress whoever play the game .and think the player
to do it in over and over.
Graphical effect –to achieve an impressive result we need a good graphical quality such as
real-time renders, soft shadows, motion blur etc. Working with these requirements i decided
to use unity 3D as my platform to develop my game with. This decision was made with
regarded to that a platform had many inbuilt tools and provide a good framework for us to get
started with development as faster as can. like project like web designing there have two
separation front end backend frontend is nothing but type of designs are used impress clients
2
and backend is used to add functionality to the front end items .similarly in my project have
front end and backend .in front end I use 3d object models that are created in different
modelling software such as 3DSMAX, BLENDER, CENEMA 4D,MAKE HUMAN etc. and
also it can used to animate a particular object in my game I use little bit animation because it
is extremely complicated one we need a lot of time to animate each and every part of
animated character .For some of the sounds effect, I use Adobe Audition and audacity.
3
2.SYSTEM REQUIREMENTS
2.1 HARDWARE SPECIFICATION
• PROCESSOR : Intel i5 7th
gen kaby lake processor
• HARD DRIVE : 1 TB
• RAM :8 GB DDR5
• GRAPHICS CARD : DUAL GRAPHICS CARD NVEDA GEFORCE GTX 940MX
4GB DEDICATED & Intel IRIS 620 INTEGRATED
• RESOLUTION : 1920*1080 FULL HD IPS PANNEL ANTI-GLARE DISPLAY
• MOUSE : OPTICAL MOUSE& PRECISION TOUCHPAD
• 2ND
DISPLAY : ACER MONITOR
2.2 SOFTWARE SPECIFICATION
• OPERATING SYSTEM : WINDOW 10 HOME (X64)
• BUILD WITH : UNITY 5 5.6.4
• DOCUMENTATION : MS WORD 2010
4
3.SOFTWARE DESCRIPTION
3.1 ABOUT OPERATING SYSTEM
Windows 10 is a personal computer operating system developed and released
by Microsoft as part of the Windows NT family of operating systems. It was released on July
29, 2015. It is the first version of Windows that receives on going feature updates. Devices in
enterprise environments can receive these updates at a slower pace or use long-term support
milestones that only receive critical updates, such as security patches, over their ten-year
lifespan of extended support.
Windows 10 introduces what Microsoft described as "universal apps" expanding
on Metro-style apps, these apps can be designed to run across multiple Microsoft product
families with nearly identical code—including PCs, tablets, smartphones, embedded
systems, Xbox One, Surface Hub and Mixed Reality.
The Windows user interface was revised to handle transitions between a mouse-
oriented interface and a touchscreen-optimized interface based on available input devices—
particularly on 2-in-1 PCs both interfaces include an updated Start menu which incorporates
elements of Windows 7's traditional Start menu with the tiles of Windows 8.
The first release of Windows 10 also introduces a virtual desktop system, a window
and desktop management feature called Task View, the Microsoft Edge web browser, support
for fingerprint and face recognition login, new security features for enterprise environments,
and DirectX 12 and WDDM 2.0 to improve the operating system's graphics capabilities
for games.
3.2 USER INTERFACE
A new iteration of the Start menu is used on the Windows 10 desktop, with a list of
places and other options on the left side, and tiles representing applications on the right. The
menu can be resized, and expanded into a full-screen display, which is the default option in
Tablet mode. A new virtual desktop system was added.
A feature known as Task View displays all open windows and allows users to switch
between them, or switch between multiple workspaces. Windows Store apps, which
5
previously could be used only in full screen mode, can now be used in self-contained
windows similarly to other programs.
Program windows can now be snapped to quadrants of the screen by dragging them
to the corner. When a window is snapped to one side of the screen, Task View appears and
the user is prompted to choose a second window to fill the unused side of the screen (called
"Snap Assist"). Windows' system icons were also changed.
Charms have been removed their functionality in Windows Store apps is accessed
from an App commands menu on their title bar. In its place is Action Centre, which displays
notifications and settings toggles. It is accessed by clicking an icon in the notification area or
dragging from the right of the screen. Notifications can be synced between multiple devices.
The Settings app (formerly PC Settings) was refreshed and now includes more options that
were previously exclusive to the desktop Control Panel
Windows 10 is designed to adapt its user interface based on the type of device being
used and available input methods. It offers two separate user interface modes: a user interface
optimized for mouse and keyboard, and a "Tablet mode" designed for touchscreens.
Users can toggle between these two modes at any time, and Windows can prompt or
automatically switch when certain events occur, such as disabling Tablet mode on a tablet if a
keyboard or mouse is plugged in, or when a 2-in-1 PC is switched to its laptop state.
In Tablet mode, programs default to a maximized view, and the taskbar contains a
back button and hides buttons for opened or pinned programs; Task View is used instead to
switch between programs. The full screen Start menu is used in this mode, similarly to
Windows 8, but scrolls vertically instead of horizontally.
3.3 C#SCRIPTING
Scripts, known in Unity as behaviours, let you take assets in your scene and make
them interactive. Multiple scripts can be attached to a single object, allowing for easy code
reuse. Unity supports three different programming languages; UnityScript, C#, and Boo.
6
UnityScript is similar to JavaScript and ActionScript, C# is similar to Java, and Boo is
similar to Python. Depending on your background you may feel more comfortable with one
or the other.
Let’s create a C# script:
1. Click Assets > Create > New C# Script
2. Rename the new script in the Project panel to PlayerScript
3. Double click the script to open it in MonoDevelop
The script should look just like this:
01
02
03
04
05
06
07
08
09
10
11
12
using UnityEngine;
using System.Collections;
public class PlayerScript : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
C# class names must be the same as their file name and are case sensitive. Make sure
your class name matches the file name exactly, excluding the file extension. All scripts have
a start () method and an update() method. The start () method is run once when the object is
first created, while the update () method runs once per frame. Our script needs to be
constantly checking for arrow keys being pressed, so we’ll add the following code to the
update() method.
7
4.PROJECT DESCRIPTION
In this project we were left free to decide what type of game we want to develop the
suggestion was that an Adventure action game is suitable since such a game usually does not
depend on advanced assets e.g. animated models. After some confusion, I decided to create
this game. To further explain how the game concept evolved the development has been
divided into two parts.
INITIAL CONCEPT
My initial concept is similar to the combination of games like IGI2 and GTA vice city
but I change my behaviour in games I try to create a unique from those two because these
games already prove that it totally differs from other graphical games so I need to create a
unique and better one.
In my game I have a player is fully loaded with weapons he can access anything on
the ground he can access and drive the car without permission I provide so many levels to
complete the mission. another idea was to create a big island for the player. In this game, the
player did not show up her face because it is a first-person shooter game if you start playing
you are the person to play the game we have seen two hands with a fully loaded weapon
FINAL CONCEPT
I collect so many ideas from the internet from variety of resources and did not follow
any development process because each time executing development face so many challenges
in both designing and coding so I need to look up from in its beginning .i compromised a lot
of subjects because I have not enough time and bright knowledge about all functions in the
unity engine each and every time I got new ideas for the game but don’t know to do that so I
take too much time for data collection and study them.
DEVELOPMENT PROCESS
In a software development project, the resulting product is required to fulfil many
different qualities. Example of such quality requirements is: Availability, Maintainability,
Dependability, and usability .to meet such varying demands, it is important to base the work
on a well-prepared strategy. In software engineering, the term for such a strategy is
commonly known as a software process, which is built a software process models.
8
A software process model is a theoretical philosophy that describes the best way of
developing software. Based on one or several models, a software process is formed
providing guidance on how to operate. A software process model may also be described as
an abstract representation of a software process. the concept of the process model is similar
to an abstract Java class, which cannot be instantiated, but it can be implemented by another
class, thus providing basic guidelines for that other class.
A model may, for example, demand customer involvement, but it does not state
exactly how .a process implementing that model should involve the customer in the process
activities but is free to choose how.
I use a software development process called Agile SDLC model. It is a combination
of iterative and incremental process models with a focus on process adaptability and
customer satisfaction by rapid delivery of working software product. Agile Methods break
the product into small incremental builds. These builds are provided in iterations. Each
iteration typically lasts from about one to three weeks. Every iteration involves cross-
functional teams working simultaneously on various areas like −
• Planning
• Requirements Analysis
• Design
• Coding
• Testing
At the end of the iteration, a working product is displayed to the customer and
important stakeholders. Agile model believes that every project needs to be handled
differently and the existing methods need to be tailored to best suit the project requirements.
In Agile, the tasks are divided into time boxes (small time frames) to deliver specific
features for a release.
An iterative approach is taken and working software build is delivered after each
iteration. Each build is incremental in terms of features; the final build holds all the features
required
Here is a graphical illustration of the Agile Model
9
4.1 GAME ENGINE
A game engine is a framework for game development this framework helps us in
several core areas that all games have it can simplify it to just three Graphics ,Audio and
Logic actually these are thing that all software has however modern game engine have
become more specialized and commonly include framework for physics ,AI, networking
,Optimization and much more .
let’s take a look at some basic functionality that most users are familiar with the most
important is the rendering engine or render this is responsible for taking codes from a
programmer and translating it to form of object in game environment based on your
perspective in the game environment the render will project that the image on the screen
depending on the characteristic of the object a render will determine its attributes .
Modern game engines also control game lighting they simulate how light reflected in
the game world and creates shadow from that because it takes lot of power to precisely render
10
individual light particles object interaction is controlled by physics engine this is responsible
for the stimulation of certain physical systems such as rigid body dynamics ,fluid dynamics
and soft body dynamics
Artificial intelligence or AI the point is stimulate human like intelligence in characters
not controlled by the player this includes walking around the gaming world not running into
the walls hiding .Without AI characters and game would be standing the entire time doing
nothing there are many types of artificial intelligence some of they are talking to some other
of each character in the game or walk from point A to point B etc..
UNITY 3D
Unity is cross-platform game engine developed by unity technologies and used to
develop video games for pc, consoles, mobile devices and websites. first announced only for
Apple OS and later it comes to all other platforms
Unity is a multipurpose game engine that supports 2D and 3D graphics, drag-and-
drop functionality, and processing using C#. Two other programming languages were
supported which was deprecated with the release of Unity 5 and JavaScript which started its
deprecation process in August 2017 after the release of Unity 2017The engine targets the
following graphics APIs: Direct3D on Windows and Xbox One; OpenGL on Linux, macOS,
and Windows. on Android and iOS, WebGL on the web; and proprietary APIs on the video
game consoles. Additionally, Unity supports the low-level APIs Metal on iOS and macOS
and Vulkan on Android, Linux, and Windows, as well as Direct3D on Windows and Xbox
One.
Within 2D games, Unity allows importation of sprites and an advanced 2D world
renderer. For 3D games, Unity allows specification of texture compression, maps, and
resolution settings for each platform that the game engine supports, and provides support for
bump mapping, reflection mapping, parallax mapping, screen space ambient occlusion
(SSAO), dynamic shadows using shadow maps, render-to-texture, and full-screen post-
processing effects. Unity also offers services to developers, these are Unity Ads, Unity
Analytics, Unity Certification, Unity Cloud Build, Unity Every play, Unity IAP, Unity
Multiplayer, Unity Performance Reporting and Unity Collaborate.
11
Here is a graphical illustration of the Unity Game engine
4.2 BASIC CONCEPT
Coordinate Space
Three axes X, Y, Z -based on the Cartesian coordinate system
Hierarchy
The Hierarchy contains every Game Object in the current Scene. Some of these are
direct instances of asset files like 3D models, and others are instances of Prefabs, custom
objects that will make up much of your game. You can select objects in the Hierarchy and
drag one object onto another to make use of parenting (see below). As objects are added and
removed in the scene, they will appear and disappear from the Hierarchy as well.
12
Parenting
Unity uses a concept called Parenting. To make any Game Object the child of another, drag
the desired child onto the desired parent in the Hierarchy. A child will inherit the movement
and rotation of its parent. You can use a parent object’s foldout arrow to show or hide its
children as necessary.
Toolbars
13
The Toolbar consists of five basic controls. Each relate to different parts of the Editor.
Transform Tools – used with the Scene View
Play/Pause/Step Buttons – used with the Game View
Play/Pause/Step Buttons – used with the Game View
Layout Drop-down – controls arrangement of all Views
Scene View
The Scene View is your interactive sandbox. You will use the Scene View to select and
position environments, the player, the camera, enemies, and all other Game Objects.
Manipulating objects within the Scene View are some of the most important functions in
Unity, so it’s important to be able to do them quickly. To this end, Unity provides keystrokes
for the most common operations.
See Scene View Navigation for full details on navigating the scene view. Here’s a brief
overview of the essentials:
Hold the right mouse button to enter Flythrough mode. This turns your mouse
and WASD keys (plus Q and E for up and down) into quick first-person view navigation.
14
Select any Game Object and press the F key. This will centre the Scene View and pivot point
on the selection.
Use the arrow keys to move around on the X/Z plane.
Hold Alt and click-drag to orbit the camera around the current pivot point.
Hold Alt and middle click-drag to drag the Scene View camera around.
Hold Alt and right click-drag to zoom the Scene View. This is the same as scrolling with your
mouse wheel.
You might also find use in the Hand Tool (shortcut: Q), especially if you are using a
one-button mouse. With the Hand tool selected:
Click- drags to drag the camera around.
Hold Alt and click-drag to orbit the camera around the current pivot
point.
Hold Alt and right click-drag to zoom the Scene View. On Mac you
can also hold Control and click-drag instead.
In the upper-right corner of the Scene View is the Scene Gizmo. This displays the Scene
Camera’s current orientation and allows you to quickly modify the viewing angle.
15
Each of the coloured “arms” of the gizmo represents a geometric axis. You can click
on any of the arms to set the camera to an orthographic (i.e. perspective-free) view looking
along the corresponding axis. You can click on the text underneath the gizmo to switch
between the normal perspective view and an isometric view. While in isometric mode, you
can right-click drag to orbit, and Alt + middle-click drag to pan.
Note that the Scene Gizmo will be hidden when the view is in 2D mode, since the view is
always directly at the XY plane.
Game view
The Game View is rendered from the Camera(s) in your game. It is representative of
your final, published game. You will need to use one or more Cameras to control what the
player actually sees when they are playing your game.
Inspector
Games in Unity are made up of multiple Game Objects that contain meshes, scripts,
sounds, or other graphical elements like Lights. The Inspector displays detailed information
about your currently selected Game Object, including all attached Components and their
properties. Here, you modify the functionality of Game Objects in your scene.
Any property that is displayed in the Inspector can be directly modified. Even script
variables can be changed without modifying the script itself.
You can use the Inspector to change variables at runtime to experiment and find the
magic gameplay for your game. In a script, if you define a public variable of an object type
(like Game object or Transform).
16
4.3 DESIGNING AND MODELING
Environment Creation
Every game need a basement for the player to follow the game so first we create a
terrain (ground) it can be created by using 3rd
party software or it can done in side unity.Click
on Game Object> Create other >Create terrain .First terrain have a default size so we can
adjusted it in the inspector window go to the transformation adjust the X and scaling to 1500,
1500 don’t modify the Z axis .The change the view to top view so we can see the full region
Now raise/low terrain tool in the inspector window (make sure that the terrain
selected in hierarchy window) I can simply draw on the top view of the ground plane in the
scene window to create certain terrain features.
I used Brush size 70 and opacity 90 to make big peaks like mountain an I reduce its
size to 30 and draw small ground peaks if any mistake are done press ctrl+z to undo the
operation
8
A software process model is a theoretical philosophy that describes the best way of
developing software. Based on one or several models, a software process is formed
providing guidance on how to operate. A software process model may also be described as
an abstract representation of a software process. the concept of the process model is similar
to an abstract Java class, which cannot be instantiated, but it can be implemented by another
class, thus providing basic guidelines for that other class.
A model may, for example, demand customer involvement, but it does not state
exactly how .a process implementing that model should involve the customer in the process
activities but is free to choose how.
I use a software development process called Agile SDLC model. It is a combination
of iterative and incremental process models with a focus on process adaptability and
customer satisfaction by rapid delivery of working software product. Agile Methods break
the product into small incremental builds. These builds are provided in iterations. Each
iteration typically lasts from about one to three weeks. Every iteration involves cross-
functional teams working simultaneously on various areas like −
• Planning
• Requirements Analysis
• Design
• Coding
• Testing
At the end of the iteration, a working product is displayed to the customer and
important stakeholders. Agile model believes that every project needs to be handled
differently and the existing methods need to be tailored to best suit the project requirements.
In Agile, the tasks are divided into time boxes (small time frames) to deliver specific
features for a release.
An iterative approach is taken and working software build is delivered after each
iteration. Each build is incremental in terms of features; the final build holds all the features
required
Here is a graphical illustration of the Agile Model
18
character. They are unlike third-person shooters, in which the player can see (usually from
behind) the character they are controlling. The primary design element is combat, mainly
involving firearms.
To create a first-person controller first create a game object go to create> game Object
>capsule press f to zoom the object selected. click on capsule in hierarchy and right click and
select camera then focus the camera on the front of the capsule add a capsule collider then
after we add three main scripts player move script, player look script and user control script
DESIGNING THE CAR MODEL
For design the car required for the game, we had to sketch out the blue print which
would fulfil all the requirement for the game.
First, we need to go of some blue prints of the car that we want to model. I tend to use
www.the-blueprint.com.
Then we open 3DsMax. We started by creating the planes .in the top viewport we created a
plane of any size.in the modify panel, we change the size of the plane to match the size for
the car.
19
Now we had our first plane we needed to create 3 more. There was more than one way of
doing this but we found this way is quickest. We press the snap rotation button then press the
“select and rotate button”.
Then we had the 4 plane set up, we wanted to add the blueprints to them .weapons the
material window .then click the small box to diffuse which open a new window double click
and “open file” window. Then we had our blue print in 3DsMax changed the name of the
material. we repeated this for each view.
Once we had all four images in 3DsMax we made sure the “visible view port” was
clicked on. We choose the plane we want to add the image to and clicked “Add Material to
Selected”. Our screen should look similar to the one below.
We did this for all planes. After this was done we selected all four Plane and right
clicked, then we choose “object properties “to open a new window. Then we unchecked
“Show Frozen in Grey” and render able. Next, we checked “Blackface cull”. Then we
converted it into all four planes to editable polygon
After selecting one plane (front)and we checked the “preserve UVs”box (right).This
allowed us to move edges of the plane without affecting the image.
Then we changed the sub object model to selected edge. On the side view of the car
we select the top edge and moved it down until no white remained. We were careful not to
cut off top of the car
20
Once our plane had no white borders it was time to move into position. using the
“select and move” tool we moved the side view back to the edge of the top view. The front
and back views went to either end of the top view .Then we moved the top view down to the
bottom of the side view.
Then we selected all planes, right clicked and selected “free selection”.
Save the file and completed modelling.
Designing Enemy
To create an enemy first create a humanoid character. for this creation I use an
application called make human it provides a human model are already there and we can
modify it change colour change the sex change the mass add muscle
12
Parenting
Unity uses a concept called Parenting. To make any Game Object the child of another, drag
the desired child onto the desired parent in the Hierarchy. A child will inherit the movement
and rotation of its parent. You can use a parent object’s foldout arrow to show or hide its
children as necessary.
Toolbars
22
Save the project and click on export button select mesh format as wave front .obj
Animation is the lot more complicated subject .so simplify the task I use a trick .I use
a website called mixamo.com this website is help us to add commonly seen animation in easy
way .import the character was created and select the joints press ok button the Rig detection
was completed and now seen a lot of animation available for the character I select 3 single
animations (idle, run, attack).
23
Now main modelling works are completed. I use so many models to create this game most of
them are not movable objects that are not covered because it take too much time to explain
about each and every small and large models so I skip that section
HOLDING GUN ON HANDS
To add a holding hand so we use the make human software and create a character by
skipping the cloth section because we need only both hands other parts are not usable make
sure that we select the pose /animation and set to default. save in. mhx2 format.
open the blender software and import the created character some times in blender not show
the mhx2 format to import so we go to preferences>add-ons>in the search box type make
human two checkbox will appear select the first one.
24
Go to the file menu again and import>mhx2 export. Now the model is successfully imported
select the character and change the object mode to edit mode now the object will appear as
editable object. Hold on the B button on key board and select the portion want to remove.
press the x button to delete.
Save the object in. fbx file format. other adjustments are done in c4D software open the c4d
software import the file select the object and choose the root>pelvis>hand in hierarchy adjust
the hands for a holding one by using the transformation tools select the bones rotate as our
concept it takes too much time for perfection aster completion save in. fbx format and import
to unity.
25
ADDING MESSAGES
Adding message is lot more easy to do fist create a cube in unity and add box collider
and mesh renderer from component then check the trigger option in box collider now we can
move over the cube .Then create a canvas by click on create>game object>cube adjust the
cube with transform tool select the canvas in hierarchy right click on the canvas and add
image adjust the image size to (width)80,(height)20.Add the c# message script. Drag and
drop the created jpg image to the script.
SPLASH SCREEN
Splash screen is used in the beginning of the game to introduce the game or to
terminate one scene to another one scene without any disturbance it can also use to show a
level was completed or failed .the technique is quite easy it can done though script we reduce
and enhance the alpha colour values .fist we remove the directional light and set skybox
colour to black create a canvas and add a image adjust the size to 1920*1080 it is my screen
resolution.
Message
26
4.4Event Functions Used
As a Script executes within Unity, there are several 'Event Functions' which are called in a
specific order. You can use them control the behaviour of your game. Let's have look at the
most popular ones, in order of execution, when starting within Unity:
Event Function: ‘Awake ()'
The ‘Awake ()' function is always called before any Start functions and also just after a
prefab is instantiated.
Event Function: ‘Start ()'
The ‘Start ()' function is called before the first frame update only if the script instance is
enabled.
Event Function: ‘Update ()'
The 'Update()' function is called every frame that the game is rendered, i.e. if your frame rate
is 30fps (frames per second) then the function will be called 30 times per second. You should
place most of your behaviour code within this function, except anything which involves
physics.
It is worth noting that the Unity Player's frame rate can fluctuate at runtime,
depending on the hardware it's running on and the computing required per frame. It is
therefore crucial that your code within this function is as optimized as possible.
Event Function: ‘Late Update ()'
The ‘Late Update ()' function is called once per frame, after the ‘Update ()' function has
finished. Any calculations that are performed in Update () will have completed when Late
Update() begins.
27
Event Function: 'Fixed Update ()'
The 'Fixed Update ()' function is called within each physics step; it will keep in sync with
Unity's physics engine. The code within this function should also be as optimized as possible.
Event Handler Function: ‘OnApplicationQuit ()'
The 'OnApplicationQuit' function is actually defined as an Event Handler; all Event Handlers
begin with 'On'. It is called on all game objects when the application is quit. In the editor it is
called when the user stops play mode. In the web player it is called when the web view is
closed.You can find more information about the Execution Order and the Update Order
within the Unity Manual
PHYSICS FUNCTIONS
COLLIDERS
Colliders are what physics engines use to perform hit detection. Unlike mesh objects,
they know when they’ve come in contact with each other. They are simple shapes like boxes,
spheres, or capsules that are assigned to your Game Objects and follow them around. You
can think of them as something of a "force field".
Conveniently, whenever a Game Object is created, it is automatically assigned an appropriate
collider. A Cube gets a BoxCollider, a Sphere gets a SphereCollider, a Cylinder gets a
CapsuleCollider, and so on
RIGIDBODY
A rigidbody is the the most critical element in a physics engine. Any GameObject it is
attached to is included in the simulation. By default, a rigidbody is affected by gravity and air
resistance, also known as drag. If we press Play, the block will start to fall, accelerate, and
eventually hit terminal velocity when the force of gravity and drag equalize.
28
5.SOURCE CODE
MOUSELOOK
using UnityEngine;
using System.Collections;
public class MouseLook : MonoBehaviour {
public enum RotationAxes { MouseXAndY = 0, MouseX = 1, MouseY = 2 }
public RotationAxes axes = RotationAxes.MouseXAndY;
public float sensitivityX = 15F;
public float sensitivityY = 15F;
public float minimumX = -360F;
public float maximumX = 360F;
public float minimumY = -60F;
public float maximumY = 60F;
float rotationY = 0F;
void Update ()
{
if (axes == RotationAxes.MouseXAndY)
{
float rotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse
X") * sensitivityX;
rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);
29
transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0);
}
else if (axes == RotationAxes.MouseX)
{
transform.Rotate(0, Input.GetAxis("Mouse X") * sensitivityX, 0);
}
else
{
rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);
transform.localEulerAngles = new Vector3(-rotationY,
transform.localEulerAngles.y, 0);
}
}
void Start ()
{
// Make the rigid body not change rotation
if (GetComponent<Rigidbody>())
GetComponent<Rigidbody>().freezeRotation = true;
}
}
FPS INPUT CONTROLLER
private var motor : CharacterMotor;
// Use this for initialization
function Awake () {
30
motor = GetComponent(CharacterMotor);
}
// Update is called once per frame
function Update () {
// Get the input vector from keyboard or analog stick
var directionVector = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
if (directionVector != Vector3.zero) {
// Get the length of the directon vector and then normalize it
// Dividing by the length is cheaper than normalizing when we already have the length any
way
var directionLength = directionVector.magnitude;
directionVector = directionVector / directionLength;
// Make sure the length is no bigger than 1
directionLength = Mathf.Min(1, directionLength);
// Make the input vector more sensitive towards the extremes and less sensitive in the mid
dle
// This makes it easier to control slow speeds when using analog sticks
directionLength = directionLength * directionLength;
// Multiply the normalized direction vector by the modified length
directionVector = directionVector * directionLength;
}
// Apply the direction to the CharacterMotor
motor.inputMoveDirection = transform.rotation * directionVector;
motor.inputJump = Input.GetButton("Jump");
}
// Require a character controller to be attached to the same game object
@script RequireComponent (CharacterMotor)
@script AddComponentMenu ("Character/FPS Input Controller")
HEALTH SCRIPT
var guiSkin : GUISkin;
var text1 : Texture;
var text2 : Texture;
var text3 : Texture;
var text4 : Texture;
var healthPoints : float;
var healtRegen : float;
var healthRegenEnabled = true;
function Update ()
{
//Health Regen
if(healthRegenEnabled == true && healthPoints < 10000)
{
31
healthPoints += healtRegen *Time.deltaTime;
}
//Check for maximum health
if(healthPoints > 10000)
{
healthPoints = 10000;
}
//Check for minimum health
if(healthPoints <= 0)
{
healthPoints = 0;
//healthRegenEnabled = false;
Debug.Log("YOU ARE DEAD!");
}
}
function OnGUI ()
{
GUI.skin = guiSkin;
GUI.Label(new Rect(Screen.width - 130, Screen.height - 90, 200, 50),
healthPoints.ToString ("F0"));
if(healthPoints<=10000)
{
GUI.DrawTexture(Rect(0,0,Screen.width,Screen.height),text1);
}
if(healthPoints<=8000)
{
GUI.DrawTexture(Rect(0,0,Screen.width,Screen.height),text2);
}
if(healthPoints<=400)
{
GUI.DrawTexture(Rect(0,0,Screen.width,Screen.height),text3);
}
if(healthPoints<=100)
{
GUI.DrawTexture(Rect(0,0,Screen.width,Screen.height),text4);
}
}
GUN SCRIPT
using UnityEngine;
public class Gun : MonoBehaviour {
public float damage = 10f;
public float range = 100f;
public float impactForce= 30f;
public Camera fpsCam;
32
public ParticleSystem muzzleflash;
public GameObject impactEffect;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetButtonDown ("Fire1"))
{
Shoot ();
}
}
void Shoot()
{
muzzleflash.Play ();
RaycastHit hit;
if (Physics.Raycast (fpsCam.transform.position, fpsCam.transform.forward, out hit, range))
{
Debug.Log (hit.transform.name);
Target target= hit.transform.GetComponent<Target>();
if (target != null)
{
target.TakeDamage (damage);
}
if (hit.rigidbody != null) {
hit.rigidbody.AddForce (-hit.normal * impactForce);
}
GameObject impactGO =Instantiate (impactEffect, hit.point, Quaternion.LookRotation (hit.
normal));
Destroy (impactGO, 2f);
}
}
}
AUDIO SCRIPT
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class audio : MonoBehaviour {
// Use this for initialization
void Start () {
}
18
character. They are unlike third-person shooters, in which the player can see (usually from
behind) the character they are controlling. The primary design element is combat, mainly
involving firearms.
To create a first-person controller first create a game object go to create> game Object
>capsule press f to zoom the object selected. click on capsule in hierarchy and right click and
select camera then focus the camera on the front of the capsule add a capsule collider then
after we add three main scripts player move script, player look script and user control script
DESIGNING THE CAR MODEL
For design the car required for the game, we had to sketch out the blue print which
would fulfil all the requirement for the game.
First, we need to go of some blue prints of the car that we want to model. I tend to use
www.the-blueprint.com.
Then we open 3DsMax. We started by creating the planes .in the top viewport we created a
plane of any size.in the modify panel, we change the size of the plane to match the size for
the car.
34
SelectedWeapon++;
}
if(Input.GetAxis("Mouse ScrollWheel") < 0f)
{
if (SelectedWeapon <= 0 )
SelectedWeapon = transform.childCount - 1;
else
SelectedWeapon--;
}
if (Input.GetKeyDown (KeyCode.Alpha1)) {
SelectedWeapon = 0;
}
if (Input.GetKeyDown (KeyCode.Alpha2) && transform.childCount >=2)
{
SelectedWeapon = 1;
}
if (Input.GetKeyDown (KeyCode.Alpha2) && transform.childCount >=3)
{
SelectedWeapon = 2;
}
if (Input.GetKeyDown (KeyCode.Alpha2) && transform.childCount >=4)
{
35
SelectedWeapon = 3;
}
if(previousSelectedWeapon!=SelectedWeapon)
{
SelectWeapon ();
}
}
void SelectWeapon()
{
int i = 0;
foreach (Transform weapon in transform) {
if (i == SelectedWeapon)
weapon.gameObject.SetActive (true);
else
weapon.gameObject.SetActive (false);
i++;
}
}
}
CAR SCRIPT
CAR CONTROLLER
using System;
using UnityEngine;
namespace UnityStandardAssets.Vehicles.Car
{
internal enum CarDriveType
{
FrontWheelDrive,
RearWheelDrive,
36
FourWheelDrive
}
internal enum SpeedType
{
MPH,
KPH
}
public class CarController : MonoBehaviour
{
[SerializeField] private CarDriveType m_CarDriveType = CarDriveType.FourWheelDrive;
[SerializeField] private WheelCollider[] m_WheelColliders = new WheelCollider[4];
[SerializeField] private GameObject[] m_WheelMeshes = new GameObject[4];
[SerializeField] private WheelEffects[] m_WheelEffects = new WheelEffects[4];
[SerializeField] private Vector3 m_CentreOfMassOffset;
[SerializeField] private float m_MaximumSteerAngle;
[Range(0, 1)] [SerializeField] private float m_SteerHelper; // 0 is raw physics , 1 the car will g
rip in the direction it is facing
[Range(0, 1)] [SerializeField] private float m_TractionControl; // 0 is no traction control, 1 is
full interference
[SerializeField] private float m_FullTorqueOverAllWheels;
[SerializeField] private float m_ReverseTorque;
[SerializeField] private float m_MaxHandbrakeTorque;
[SerializeField] private float m_Downforce = 100f;
[SerializeField] private SpeedType m_SpeedType;
[SerializeField] private float m_Topspeed = 200;
[SerializeField] private static int NoOfGears = 5;
[SerializeField] private float m_RevRangeBoundary = 1f;
[SerializeField] private float m_SlipLimit;
[SerializeField] private float m_BrakeTorque;
private Quaternion[] m_WheelMeshLocalRotations;
private Vector3 m_Prevpos, m_Pos;
private float m_SteerAngle;
private int m_GearNum;
private float m_GearFactor;
private float m_OldRotation;
private float m_CurrentTorque;
private Rigidbody m_Rigidbody;
private const float k_ReversingThreshold = 0.01f;
public bool Skidding { get; private set; }
public float BrakeInput { get; private set; }
public float CurrentSteerAngle{ get { return m_SteerAngle; }}
public float CurrentSpeed{ get { return m_Rigidbody.velocity.magnitude*2.23693629f; }}
public float MaxSpeed{get { return m_Topspeed; }}
public float Revs { get; private set; }
public float AccelInput { get; private set; }
// Use this for initialization
private void Start()
{
m_WheelMeshLocalRotations = new Quaternion[4];
37
for (int i = 0; i < 4; i++)
{
m_WheelMeshLocalRotations[i] = m_WheelMeshes[i].transform.localRotation;
}
m_WheelColliders[0].attachedRigidbody.centerOfMass = m_CentreOfMassOffset;
m_MaxHandbrakeTorque = float.MaxValue;
m_Rigidbody = GetComponent<Rigidbody>();
m_CurrentTorque = m_FullTorqueOverAllWheels -
(m_TractionControl*m_FullTorqueOverAllWheels);
}
private void GearChanging()
{
float f = Mathf.Abs(CurrentSpeed/MaxSpeed);
float upgearlimit = (1/(float) NoOfGears)*(m_GearNum + 1);
float downgearlimit = (1/(float) NoOfGears)*m_GearNum;
if (m_GearNum > 0 && f < downgearlimit)
{
m_GearNum--;
}
if (f > upgearlimit && (m_GearNum < (NoOfGears - 1)))
{
m_GearNum++;
}
}
// simple function to add a curved bias towards 1 for a value in the 0-1 range
private static float CurveFactor(float factor)
{
return 1 - (1 - factor)*(1 - factor);
}
// unclamped version of Lerp, to allow value to exceed the from-to range
private static float ULerp(float from, float to, float value)
{
return (1.0f - value)*from + value*to;
}
private void CalculateGearFactor()
{
float f = (1/(float) NoOfGears);
// gear factor is a normalised representation of the current speed within the current gear's r
ange of speeds.
// We smooth towards the 'target' gear factor, so that revs don't instantly snap up or down
when changing gear.
var targetGearFactor = Mathf.InverseLerp(f*m_GearNum, f*(m_GearNum + 1), Mathf.Abs(
19
Now we had our first plane we needed to create 3 more. There was more than one way of
doing this but we found this way is quickest. We press the snap rotation button then press the
“select and rotate button”.
Then we had the 4 plane set up, we wanted to add the blueprints to them .weapons the
material window .then click the small box to diffuse which open a new window double click
and “open file” window. Then we had our blue print in 3DsMax changed the name of the
material. we repeated this for each view.
Once we had all four images in 3DsMax we made sure the “visible view port” was
clicked on. We choose the plane we want to add the image to and clicked “Add Material to
Selected”. Our screen should look similar to the one below.
We did this for all planes. After this was done we selected all four Plane and right
clicked, then we choose “object properties “to open a new window. Then we unchecked
“Show Frozen in Grey” and render able. Next, we checked “Blackface cull”. Then we
converted it into all four planes to editable polygon
After selecting one plane (front)and we checked the “preserve UVs”box (right).This
allowed us to move edges of the plane without affecting the image.
Then we changed the sub object model to selected edge. On the side view of the car
we select the top edge and moved it down until no white remained. We were careful not to
cut off top of the car
39
CalculateRevs();
GearChanging();
AddDownForce();
CheckForWheelSpin();
TractionControl();
}
private void CapSpeed()
{
float speed = m_Rigidbody.velocity.magnitude;
switch (m_SpeedType)
{
case SpeedType.MPH:
speed *= 2.23693629f;
if (speed > m_Topspeed)
m_Rigidbody.velocity = (m_Topspeed/2.23693629f) * m_Rigidbody.velocity.normal
ized;
break;
case SpeedType.KPH:
speed *= 3.6f;
if (speed > m_Topspeed)
m_Rigidbody.velocity = (m_Topspeed/3.6f) * m_Rigidbody.velocity.normalized;
break;
}
}
private void ApplyDrive(float accel, float footbrake)
{
float thrustTorque;
switch (m_CarDriveType)
{
case CarDriveType.FourWheelDrive:
thrustTorque = accel * (m_CurrentTorque / 4f);
for (int i = 0; i < 4; i++)
{
m_WheelColliders[i].motorTorque = thrustTorque;
}
break;
case CarDriveType.FrontWheelDrive:
thrustTorque = accel * (m_CurrentTorque / 2f);
m_WheelColliders[0].motorTorque = m_WheelColliders[1].motorTorque = thrustTorq
ue;
break;
case CarDriveType.RearWheelDrive:
thrustTorque = accel * (m_CurrentTorque / 2f);
m_WheelColliders[2].motorTorque = m_WheelColliders[3].motorTorque = thrustTorq
40
ue;
break;
}
for (int i = 0; i < 4; i++)
{
if (CurrentSpeed > 5 && Vector3.Angle(transform.forward, m_Rigidbody.velocity) < 50f
)
{
m_WheelColliders[i].brakeTorque = m_BrakeTorque*footbrake;
}
else if (footbrake > 0)
{
m_WheelColliders[i].brakeTorque = 0f;
m_WheelColliders[i].motorTorque = -m_ReverseTorque*footbrake;
}
}
}
private void SteerHelper()
{
for (int i = 0; i < 4; i++)
{
WheelHit wheelhit;
m_WheelColliders[i].GetGroundHit(out wheelhit);
if (wheelhit.normal == Vector3.zero)
return; // wheels arent on the ground so dont realign the rigidbody velocity
}
// this if is needed to avoid gimbal lock problems that will make the car suddenly shift direct
ion
if (Mathf.Abs(m_OldRotation - transform.eulerAngles.y) < 10f)
{
var turnadjust = (transform.eulerAngles.y - m_OldRotation) * m_SteerHelper;
Quaternion velRotation = Quaternion.AngleAxis(turnadjust, Vector3.up);
m_Rigidbody.velocity = velRotation * m_Rigidbody.velocity;
}
m_OldRotation = transform.eulerAngles.y;
}
// this is used to add more grip in relation to speed
private void AddDownForce()
{
m_WheelColliders[0].attachedRigidbody.AddForce(-transform.up*m_Downforce*
m_WheelColliders[0].attachedRigidbody.velocity.magnitude);
}
// checks if the wheels are spinning and is so does three things
// 1) emits particles
// 2) plays tiure skidding sounds
41
// 3) leaves skidmarks on the ground
// these effects are controlled through the WheelEffects class
private void CheckForWheelSpin()
{
// loop through all wheels
for (int i = 0; i < 4; i++)
{
WheelHit wheelHit;
m_WheelColliders[i].GetGroundHit(out wheelHit);
// is the tire slipping above the given threshhold
if (Mathf.Abs(wheelHit.forwardSlip) >= m_SlipLimit || Mathf.Abs(wheelHit.sidewaysSlip
) >= m_SlipLimit)
{
m_WheelEffects[i].EmitTyreSmoke();
// avoiding all four tires screeching at the same time
// if they do it can lead to some strange audio artefacts
if (!AnySkidSoundPlaying())
{
m_WheelEffects[i].PlayAudio();
}
continue;
}
// if it wasnt slipping stop all the audio
if (m_WheelEffects[i].PlayingAudio)
{
m_WheelEffects[i].StopAudio();
}
// end the trail generation
m_WheelEffects[i].EndSkidTrail();
}
}
// crude traction control that reduces the power to wheel if the car is wheel spinning too much
private void TractionControl()
{
WheelHit wheelHit;
switch (m_CarDriveType)
{
case CarDriveType.FourWheelDrive:
// loop through all wheels
for (int i = 0; i < 4; i++)
{
m_WheelColliders[i].GetGroundHit(out wheelHit);
AdjustTorque(wheelHit.forwardSlip);
}
break;
case CarDriveType.RearWheelDrive:
m_WheelColliders[2].GetGroundHit(out wheelHit);
AdjustTorque(wheelHit.forwardSlip);
42
m_WheelColliders[3].GetGroundHit(out wheelHit);
AdjustTorque(wheelHit.forwardSlip);
break;
case CarDriveType.FrontWheelDrive:
m_WheelColliders[0].GetGroundHit(out wheelHit);
AdjustTorque(wheelHit.forwardSlip);
m_WheelColliders[1].GetGroundHit(out wheelHit);
AdjustTorque(wheelHit.forwardSlip);
break;
}
}
private void AdjustTorque(float forwardSlip)
{
if (forwardSlip >= m_SlipLimit && m_CurrentTorque >= 0)
{
m_CurrentTorque -= 10 * m_TractionControl;
}
else
{
m_CurrentTorque += 10 * m_TractionControl;
if (m_CurrentTorque > m_FullTorqueOverAllWheels)
{
m_CurrentTorque = m_FullTorqueOverAllWheels;
}
}
}
private bool AnySkidSoundPlaying()
{
for (int i = 0; i < 4; i++)
{
if (m_WheelEffects[i].PlayingAudio)
{
return true;
}
}
return false;
}
}
}
CAR USER CONTROLLER
using System;
using UnityEngine;
43
using UnityStandardAssets.CrossPlatformInput;
namespace UnityStandardAssets.Vehicles.Car
{
[RequireComponent(typeof (CarController))]
public class CarUserControl : MonoBehaviour
{
private CarController m_Car; // the car controller we want to use
private void Awake()
{
// get the car controller
m_Car = GetComponent<CarController>();
}
private void FixedUpdate()
{
// pass the input to the car!
float h = CrossPlatformInputManager.GetAxis("Horizontal");
float v = CrossPlatformInputManager.GetAxis("Vertical");
#if !MOBILE_INPUT
float handbrake = CrossPlatformInputManager.GetAxis("Jump");
m_Car.Move(h, v, v, handbrake);
#else
m_Car.Move(h, v, v, 0f);
#endif
}
}
}
CAR SOUND
namespace UnityStandardAssets.Vehicles.Car
{
[RequireComponent(typeof (CarController))]
public class CarAudio : MonoBehaviour
{
// This script reads some of the car's current properties and plays sounds accordingly.
// The engine sound can be a simple single clip which is looped and pitched, or it
// can be a crossfaded blend of four clips which represent the timbre of the engine
// at different RPM and Throttle state.
// the engine clips should all be a steady pitch, not rising or falling.
// when using four channel engine crossfading, the four clips should be:
// lowAccelClip : The engine at low revs, with throttle open (i.e. begining acceleration at very l
ow speed)
// highAccelClip : Thenengine at high revs, with throttle open (i.e. accelerating, but almost at
max speed)
// lowDecelClip : The engine at low revs, with throttle at minimum (i.e. idling or engine-
44
braking at very low speed)
// highDecelClip : Thenengine at high revs, with throttle at minimum (i.e. engine-
braking at very high speed)
// For proper crossfading, the clips pitches should all match, with an octave offset between low
and high.
public enum EngineAudioOptions // Options for the engine audio
{
Simple, // Simple style audio
FourChannel // four Channel audio
}
public EngineAudioOptions engineSoundStyle = EngineAudioOptions.FourChannel;// Set th
e default audio options to be four channel
public AudioClip lowAccelClip; // Audio clip for low acceleration
public AudioClip lowDecelClip; // Audio clip for low deceleration
public AudioClip highAccelClip; // Audio clip for high acceleration
public AudioClip highDecelClip; // Audio clip for high deceleration
public float pitchMultiplier = 1f; // Used for altering the pitch of audio c
lips
public float lowPitchMin = 1f; // The lowest possible pitch for the low
sounds
public float lowPitchMax = 6f; // The highest possible pitch for the lo
w sounds
public float highPitchMultiplier = 0.25f; // Used for altering the pitch of hig
h sounds
public float maxRolloffDistance = 500; // The maximum distance where r
ollof starts to take place
public float dopplerLevel = 1; // The mount of doppler effect used in t
he audio
public bool useDoppler = true; // Toggle for using doppler
private AudioSource m_LowAccel; // Source for the low acceleration sounds
private AudioSource m_LowDecel; // Source for the low deceleration sounds
private AudioSource m_HighAccel; // Source for the high acceleration sounds
private AudioSource m_HighDecel; // Source for the high deceleration sounds
private bool m_StartedSound; // flag for knowing if we have started sounds
private CarController m_CarController; // Reference to car we are controlling
private void StartSound()
{
// get the carcontroller ( this will not be null as we have require component)
m_CarController = GetComponent<CarController>();
// setup the simple audio source
m_HighAccel = SetUpEngineAudioSource(highAccelClip);
// if we have four channel audio setup the four audio sources
if (engineSoundStyle == EngineAudioOptions.FourChannel)
{
m_LowAccel = SetUpEngineAudioSource(lowAccelClip);
45
m_LowDecel = SetUpEngineAudioSource(lowDecelClip);
m_HighDecel = SetUpEngineAudioSource(highDecelClip);
}
// flag that we have started the sounds playing
m_StartedSound = true;
}
private void StopSound()
{
//Destroy all audio sources on this object:
foreach (var source in GetComponents<AudioSource>())
{
Destroy(source);
}
m_StartedSound = false;
}
// Update is called once per frame
private void Update()
{
// get the distance to main camera
float camDist = (Camera.main.transform.position - transform.position).sqrMagnitude;
// stop sound if the object is beyond the maximum roll off distance
if (m_StartedSound && camDist > maxRolloffDistance*maxRolloffDistance)
{
StopSound();
}
// start the sound if not playing and it is nearer than the maximum distance
if (!m_StartedSound && camDist < maxRolloffDistance*maxRolloffDistance)
{
StartSound();
}
if (m_StartedSound)
{
// The pitch is interpolated between the min and max values, according to the car's revs.
float pitch = ULerp(lowPitchMin, lowPitchMax, m_CarController.Revs);
// clamp to minimum pitch (note, not clamped to max for high revs while burning out)
pitch = Mathf.Min(lowPitchMax, pitch);
if (engineSoundStyle == EngineAudioOptions.Simple)
{
// for 1 channel engine sound, it's oh so simple:
m_HighAccel.pitch = pitch*pitchMultiplier*highPitchMultiplier;
m_HighAccel.dopplerLevel = useDoppler ? dopplerLevel : 0;
m_HighAccel.volume = 1;
}
46
else
{
// for 4 channel engine sound, it's a little more complex:
// adjust the pitches based on the multipliers
m_LowAccel.pitch = pitch*pitchMultiplier;
m_LowDecel.pitch = pitch*pitchMultiplier;
m_HighAccel.pitch = pitch*highPitchMultiplier*pitchMultiplier;
m_HighDecel.pitch = pitch*highPitchMultiplier*pitchMultiplier;
// get values for fading the sounds based on the acceleration
float accFade = Mathf.Abs(m_CarController.AccelInput);
float decFade = 1 - accFade;
// get the high fade value based on the cars revs
float highFade = Mathf.InverseLerp(0.2f, 0.8f, m_CarController.Revs);
float lowFade = 1 - highFade;
// adjust the values to be more realistic
highFade = 1 - ((1 - highFade)*(1 - highFade));
lowFade = 1 - ((1 - lowFade)*(1 - lowFade));
accFade = 1 - ((1 - accFade)*(1 - accFade));
decFade = 1 - ((1 - decFade)*(1 - decFade));
// adjust the source volumes based on the fade values
m_LowAccel.volume = lowFade*accFade;
m_LowDecel.volume = lowFade*decFade;
m_HighAccel.volume = highFade*accFade;
m_HighDecel.volume = highFade*decFade;
// adjust the doppler levels
m_HighAccel.dopplerLevel = useDoppler ? dopplerLevel : 0;
m_LowAccel.dopplerLevel = useDoppler ? dopplerLevel : 0;
m_HighDecel.dopplerLevel = useDoppler ? dopplerLevel : 0;
m_LowDecel.dopplerLevel = useDoppler ? dopplerLevel : 0;
}
}
}
// sets up and adds new audio source to the gane object
private AudioSource SetUpEngineAudioSource(AudioClip clip)
{
// create the new audio source component on the game object and set up its properties
AudioSource source = gameObject.AddComponent<AudioSource>();
source.clip = clip;
source.volume = 0;
source.loop = true;
// start the clip from a random point
source.time = Random.Range(0f, clip.length);
source.Play();
source.minDistance = 5;
source.maxDistance = maxRolloffDistance;
47
source.dopplerLevel = 0;
return source;
}
// unclamped versions of Lerp and Inverse Lerp, to allow value to exceed the from-to range
private static float ULerp(float from, float to, float value)
{
return (1.0f - value)*from + value*to;
}
}
}
ENTER TO THE CAR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.Vehicles.Car;
public class CarManager : MonoBehaviour {
public Camera carCam;
public CarUserControl userCtrl;
private bool inVeh;
private GameObject player;
void Start () {
userCtrl.enabled = false;
carCam.enabled = false;
inVeh = false;
}
void Update () {
if (Input.GetKeyDown(KeyCode.E))
{
if(inVeh == true)
{
vehicleControl(null);
}
}
}
public void vehicleControl(GameObject playerObj)
{
if(inVeh == false)
{
player = playerObj;
carCam.enabled = true;
userCtrl.enabled = true;
48
player.SetActive(false);
player.transform.parent = this.transform;
StartCoroutine(Time(true));
}
else
{
player.SetActive(true);
carCam.enabled = false;
userCtrl.enabled = false;
player.transform.parent = null;
player = null;
StartCoroutine(Time(false));
}
}
private IEnumerator Time(bool inVehicle)
{
yield return new WaitForSeconds(1);
inVeh = inVehicle;
}
}
DOOR TRIGGER
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DoorTrigger : MonoBehaviour {
private bool inTrigger;
private GameObject player;
public CarManager carMan;
void Update()
{
if(inTrigger == true)
{
if (Input.GetKeyDown(KeyCode.E))
{
carMan.vehicleControl(player);
inTrigger = false;
49
}
}
}
void OnTriggerEnter (Collider col) {
inTrigger = true;
player = col.gameObject;
}
void OnTriggerExit()
{
inTrigger = false;
player = null;
}
}
ENEMY SCRIPTS
using UnityEngine;
public class chase : MonoBehaviour {
public Transform player;
public Transform head;
static Animator anim;
bool pursuing=false;
// Use this for initialization
void Start () {
anim = GetComponent<Animator> ();
}
// Update is called once per frame
void Update () {
Vector3 direction = player.position - this.transform.position;
direction.y = 0;
float angle = Vector3.Angle (direction,this.transform.forward);
if (Vector3.Distance (player.position, this.transform.position) < 60 && (angle < 360 || pursui
ng) )
{
pursuing = true;
this.transform.rotation = Quaternion.Slerp (this.transform.rotation, Quaternion.LookRota
tion (direction), 0.1f);
50
anim.SetBool("isIdle",false);
if (direction.magnitude > 5) {
this.transform.Translate (0, 0,0.05f);
anim.SetBool ("isWalking", true);
anim.SetBool ("isAttacking", false);
}
else {
anim.SetBool ("isAttacking", true);
anim.SetBool ("isWalking", false);
}
}
else
{
anim.SetBool ("isIdle",true);
anim.SetBool ("isWalking", false);
anim.SetBool ("isAttacking", false);
pursuing = false;
}
}
}
DESTROY
var damage = 10;
var damageTimer : float;
var healthScript : Health;
var player : GameObject;
var UI_text : GameObject;
var Deathcamera : GameObject;
var restart_button : GameObject;
function Start ()
{
UI_text.SetActive (false);
Deathcamera.SetActive (false);
restart_button.SetActive (false);
}
function Update ()
{
//Delete on Death
if(healthScript.healthPoints <= 0)
{
Destroy(player);
UI_text.SetActive (true);
51
Deathcamera.SetActive (true);
restart_button.SetActive (true);
}
}
function OnTriggerStay (other : Collider)
{
if (other.tag == "Player")
{
healthScript.healthPoints -= damage;
}
}
AUDIO
#pragma strict
var winner :AudioClip;
function Start () {
}
function Update () {
}
function OnTriggerEnter(){
GetComponent.<AudioSource>().PlayOneShot(winner);
}
ENEMY SPAWN
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemySpawn : MonoBehaviour {
public GameObject enemy;
public Transform enemyPos;
private float repeatRate =5.0f;
public
// Use this for initialization
void Start () {
}
void OnTriggerEnter(Collider other)
52
{
if(other.gameObject.tag =="Player")
{
InvokeRepeating ("EnemySpawner", 0.5f, repeatRate);
Destroy (gameObject, 11);
gameObject.GetComponent<BoxCollider> ().enabled = false;
}
}
void EnemySpawner()
{
Instantiate (enemy, enemyPos.position, enemyPos.rotation);
}
}
MESSAGES
#pragma strict
private var guiShow : boolean =false;
var riddle : Texture;
function OnTriggerStay(Col:Collider)
{
if(Col.tag=="Car")
{
guiShow= true;
}
}
function OnTriggerExit(Col:Collider)
{
if(Col.tag=="Car")
{
guiShow= false;
}
}
function OnGUI()
{
if(guiShow==true)
{
GUI.DrawTexture(Rect(Screen.width/ 130,Screen.height/ 90,500,300),riddle);
}
}
PAUSE MENU
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
53
public class PauseMenu : MonoBehaviour {
public static bool GameIsPaused = false;
public GameObject pauseMenuUI;
// Update is called once per frame
void Update () {
if (Input.GetKeyDown (KeyCode.Escape)) {
if (GameIsPaused) {
Resume ();
} else {
Pause ();
}
}
}
public void Resume ()
{
pauseMenuUI.SetActive (false);
Time.timeScale = 1f;
GameIsPaused = false;
}
void Pause ()
{
pauseMenuUI.SetActive (true);
Time.timeScale = 0f;
GameIsPaused = true;
}
public void LoadMenu ()
{
Time.timeScale = 1f;
SceneManager.LoadScene ("Menu");
}
public void QuitGame()
{
Application.Quit();
}
}
54
RESTART
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class restart : MonoBehaviour
{
public Button Text;
public AudioClip sound;
public string level;
void Start ()
{
Text = Text.GetComponent<Button> ();
}
public void Press()
{
Text.enabled = true;
AudioSource.PlayClipAtPoint(sound, transform.position);
Application.LoadLevel(level);
}
}
55
KEYPAD
public string input;
public bool onTrigger;
public bool doorOpen;
public bool keypadScreen;
public Transform doorHinge;
void OnTriggerEnter(Collider other)
{
onTrigger = true;
}
void OnTriggerExit(Collider other)
{
onTrigger = false;
keypadScreen = false;
input = "";
}
void Update()
{
if(input == curPassword)
{
doorOpen = true;
}
if(doorOpen)
56
{
var newRot = Quaternion.RotateTowards(doorHinge.rotation,
Quaternion.Euler(0.0f, -90.0f, 0.0f), Time.deltaTime * 250);
doorHinge.rotation = newRot;
}
}
void OnGUI()
{
if(!doorOpen)
{
if(onTrigger)
{
GUI.Box(new Rect(0, 0, 200, 25), "Press 'T' to open keypad");
if(Input.GetKeyDown(KeyCode.T))
{
keypadScreen = true;
onTrigger = false;
}
}
if(keypadScreen)
{
GUI.Box(new Rect(0, 0, 320, 455), "");
GUI.Box(new Rect(5, 5, 310, 25), input);
if(GUI.Button(new Rect(5, 35, 100, 100), "1"))
27
Event Function: 'Fixed Update ()'
The 'Fixed Update ()' function is called within each physics step; it will keep in sync with
Unity's physics engine. The code within this function should also be as optimized as possible.
Event Handler Function: ‘OnApplicationQuit ()'
The 'OnApplicationQuit' function is actually defined as an Event Handler; all Event Handlers
begin with 'On'. It is called on all game objects when the application is quit. In the editor it is
called when the user stops play mode. In the web player it is called when the web view is
closed.You can find more information about the Execution Order and the Update Order
within the Unity Manual
PHYSICS FUNCTIONS
COLLIDERS
Colliders are what physics engines use to perform hit detection. Unlike mesh objects,
they know when they’ve come in contact with each other. They are simple shapes like boxes,
spheres, or capsules that are assigned to your Game Objects and follow them around. You
can think of them as something of a "force field".
Conveniently, whenever a Game Object is created, it is automatically assigned an appropriate
collider. A Cube gets a BoxCollider, a Sphere gets a SphereCollider, a Cylinder gets a
CapsuleCollider, and so on
RIGIDBODY
A rigidbody is the the most critical element in a physics engine. Any GameObject it is
attached to is included in the simulation. By default, a rigidbody is affected by gravity and air
resistance, also known as drag. If we press Play, the block will start to fall, accelerate, and
eventually hit terminal velocity when the force of gravity and drag equalize.
58
if(GUI.Button(new Rect(5, 245, 100, 100), "7"))
{
input = input + "7";
}
if(GUI.Button(new Rect(110, 245, 100, 100), "8"))
{
input = input + "8";
}
if(GUI.Button(new Rect(215, 245, 100, 100), "9"))
{
input = input + "9";
}
if(GUI.Button(new Rect(110, 350, 100, 100), "0"))
{
input = input + "0";
}
}
}
}
}
MOVING SCENE
using System.Collections;
using System.Collections.Generic;
59
using UnityEngine;
using UnityEngine.SceneManagement;
public class MoveScene : MonoBehaviour {
[SerializeField] private string loadLevel;
void OnTriggerEnter(Collider other)
{
if(other.CompareTag("Player"))
{
SceneManager.LoadScene (loadLevel);
}
}
}
SPLASH SCREEN
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class SplashFade : MonoBehaviour {
public Image splashImage;
public string loadLevel;
IEnumerator Start()
60
{
splashImage.canvasRenderer.SetAlpha (0.0f);
FadeIn ();
yield return new WaitForSeconds (2.5f);
FadeOut ();
yield return new WaitForSeconds (2.5f);
SceneManager.LoadScene (loadLevel);
}
void FadeIn()
{
splashImage.CrossFadeAlpha (1.0f, 1.5f, false);
}
void FadeOut()
{
splashImage.CrossFadeAlpha (0.0f, 2.5f, false);
}
}
MAIN MENU
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class MainMenu : MonoBehaviour {
// Use this for initialization
public void PLayerGame ()
{
61
SceneManager.LoadScene (SceneManager.GetActiveScene ().buildIndex + 1);
}
public void QuitGame()
{
Debug.Log ("QUIT");
Application.Quit ();
}
}
DESTROY GAME OBJECT PLAYING A SOUND
#pragma strict
var CoinSound:AudioClip;
function OnTriggerEnter(other:Collider)
{
if(other.tag=="Player")
{
GetComponent.<AudioSource>().PlayOneShot(CoinSound);
yield WaitForSeconds(0.4);
Destroy(gameObject);
}
}
ENHANCE THE SPEED OF GAME
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class speed : MonoBehaviour {
// Use this for initialization
void Start () {
}
62
// Update is called once per frame
void Update () {
Time.timeScale = 1.5f;
}
}
DISPLAY THE SCORE
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ScoreTextScript : MonoBehaviour {
Text text;
public static int coinAmount;
// Use this for initialization
void Start () {
text = GetComponent<Text> ();
}
// Update is called once per frame
void Update () {
text.text = coinAmount.ToString ();
}
}
63
6.SAMPLE SCREEN LAYOUT
64
65
66
IMPLEMENTATION TOOLS REQURED
67
7.CONCLUSION
Working with the game engine completely anew experience for us. Normally we are
working with different object-oriented languages, DBMS, mark up languages etc. I adopted
these things through video tutorials, text tutorials internet and learning materials given by the
tools themselves. It’s a matter of time, patience, and hard work. It is very sensible work it
demands much time because the game engines try to connect the game environment with the
real world. creating a 3d model is very difficult because I need to work each and every point
in that model.
MY ACHIEVEMENTS
• Develop communication skill
• Understand what an SRS document is how it is helpful to my project
• So much knowledge about modelling and animation
• Growing creative thinking
• Rapidly improve imagination capability
• Time management
• Improve typing skill
• More deeply understand the scripting languages
• Control my frustration
• I spend a whole day in front of a pc to do my project without sleep without food as proper
diet my only one aim is to complete this project in any way I strongly believe that I surely
achieve this task. I’m never ready to give up.
• Understand how much effort needed to achieve my goal
68
8.FUTURE ENHANCEMENT
The present project has been developed to meet the aspirations indicated in the
modern age. An attempt has been made through this project to do all work ease and the fast
.my project will implement in future after making some changes and modifications as we
make our project at a very low level .so the modifications that can be done in our project are:
IT can be made with good graphics.
69
9.BIBLIOGRAPHY
BOOK REFERED
• Learning C# Programming with Unity 3D Book by Alex Okita
WEBSITE REFERED
• https://unity3d.com/
• https://www.lynda.com/Unity-training-tutorials/1242-0.html
• http://www.learncs.org/
• https://www.youtube.com/user/Brackeys
• https://www.youtube.com/channel/UCRMXHQ2rJ9_0CHS7mhL7erg
• https://www.udemy.com/unitycourse/

More Related Content

What's hot

Game development
Game developmentGame development
Game development
RareCoders
 
Gaming Presentation
Gaming  PresentationGaming  Presentation
Gaming Presentation
Mahipal Singh
 
LAFS Game Design 1 - Structural Elements
LAFS Game Design 1 - Structural ElementsLAFS Game Design 1 - Structural Elements
LAFS Game Design 1 - Structural Elements
David Mullich
 
06. Game Architecture
06. Game Architecture06. Game Architecture
06. Game Architecture
Amin Babadi
 
Ready, aim, create an FPS in Unity - Unite Copenhagen 2019
Ready, aim, create an FPS in Unity - Unite Copenhagen 2019Ready, aim, create an FPS in Unity - Unite Copenhagen 2019
Ready, aim, create an FPS in Unity - Unite Copenhagen 2019
Unity Technologies
 
Street runner final
Street runner finalStreet runner final
Street runner final
Kumar Narayan
 
Game Design Document - Step by Step Guide
Game Design Document - Step by Step GuideGame Design Document - Step by Step Guide
Game Design Document - Step by Step Guide
DevBatch Inc.
 
Game Development Step by Step
Game Development Step by StepGame Development Step by Step
Game Development Step by Step
Bayu Sembada
 
Car racing game for android
Car racing game for androidCar racing game for android
Car racing game for android
ravijot singh
 
Introduction to Game Development
Introduction to Game DevelopmentIntroduction to Game Development
Introduction to Game Development
Sumit Jain
 
Introduction to Game Development
Introduction to Game DevelopmentIntroduction to Game Development
Introduction to Game Development
Reggie Niccolo Santos
 
Phases of game development
Phases of game developmentPhases of game development
Phases of game development
Victor Terekhovskyi
 
Diseño de videojuegos
Diseño de videojuegosDiseño de videojuegos
Gaming Console Report By Fahad
Gaming Console Report By FahadGaming Console Report By Fahad
Gaming Console Report By Fahad
Fahad Mohammad
 
Game Design Fundamentals
Game Design FundamentalsGame Design Fundamentals
Game Design Fundamentals
Intelligent_ly
 
Final year project presentation
Final year project presentationFinal year project presentation
Final year project presentation
SulemanAliMalik
 
Introduction to Unity3D Game Engine
Introduction to Unity3D Game EngineIntroduction to Unity3D Game Engine
Introduction to Unity3D Game Engine
Mohsen Mirhoseini
 
Game development life cycle
Game development life cycleGame development life cycle
Game development life cycle
Sarah Alazab
 
Report on car racing game for android
Report on car racing game for androidReport on car racing game for android
Report on car racing game for android
ravijot singh
 
Gaming Consoles
Gaming ConsolesGaming Consoles
Gaming Consoles
Alan Leewllyn Bivera
 

What's hot (20)

Game development
Game developmentGame development
Game development
 
Gaming Presentation
Gaming  PresentationGaming  Presentation
Gaming Presentation
 
LAFS Game Design 1 - Structural Elements
LAFS Game Design 1 - Structural ElementsLAFS Game Design 1 - Structural Elements
LAFS Game Design 1 - Structural Elements
 
06. Game Architecture
06. Game Architecture06. Game Architecture
06. Game Architecture
 
Ready, aim, create an FPS in Unity - Unite Copenhagen 2019
Ready, aim, create an FPS in Unity - Unite Copenhagen 2019Ready, aim, create an FPS in Unity - Unite Copenhagen 2019
Ready, aim, create an FPS in Unity - Unite Copenhagen 2019
 
Street runner final
Street runner finalStreet runner final
Street runner final
 
Game Design Document - Step by Step Guide
Game Design Document - Step by Step GuideGame Design Document - Step by Step Guide
Game Design Document - Step by Step Guide
 
Game Development Step by Step
Game Development Step by StepGame Development Step by Step
Game Development Step by Step
 
Car racing game for android
Car racing game for androidCar racing game for android
Car racing game for android
 
Introduction to Game Development
Introduction to Game DevelopmentIntroduction to Game Development
Introduction to Game Development
 
Introduction to Game Development
Introduction to Game DevelopmentIntroduction to Game Development
Introduction to Game Development
 
Phases of game development
Phases of game developmentPhases of game development
Phases of game development
 
Diseño de videojuegos
Diseño de videojuegosDiseño de videojuegos
Diseño de videojuegos
 
Gaming Console Report By Fahad
Gaming Console Report By FahadGaming Console Report By Fahad
Gaming Console Report By Fahad
 
Game Design Fundamentals
Game Design FundamentalsGame Design Fundamentals
Game Design Fundamentals
 
Final year project presentation
Final year project presentationFinal year project presentation
Final year project presentation
 
Introduction to Unity3D Game Engine
Introduction to Unity3D Game EngineIntroduction to Unity3D Game Engine
Introduction to Unity3D Game Engine
 
Game development life cycle
Game development life cycleGame development life cycle
Game development life cycle
 
Report on car racing game for android
Report on car racing game for androidReport on car racing game for android
Report on car racing game for android
 
Gaming Consoles
Gaming ConsolesGaming Consoles
Gaming Consoles
 

Similar to FIRST PERSON SHOOTER GAME UNITY 3D

Accepting the Challenges in Devising Video Game Leeway and Contrivance
Accepting the Challenges in Devising Video Game Leeway and ContrivanceAccepting the Challenges in Devising Video Game Leeway and Contrivance
Accepting the Challenges in Devising Video Game Leeway and Contrivance
DR.P.S.JAGADEESH KUMAR
 
Ancient world online
Ancient world online Ancient world online
Ancient world online
SeifElDeen3
 
CG_report_merged (1).pdf
CG_report_merged (1).pdfCG_report_merged (1).pdf
CG_report_merged (1).pdf
rahul812082
 
Road attack
Road attackRoad attack
Road attack
Samba Siva
 
Squid Game and Music Synchronization
Squid Game and Music SynchronizationSquid Game and Music Synchronization
Squid Game and Music Synchronization
IRJET Journal
 
STUDY OF AN APPLICATION DEVELOPMENT ENVIRONMENT BASED ON UNITY GAME ENGINE
STUDY OF AN APPLICATION DEVELOPMENT ENVIRONMENT BASED ON UNITY GAME ENGINESTUDY OF AN APPLICATION DEVELOPMENT ENVIRONMENT BASED ON UNITY GAME ENGINE
STUDY OF AN APPLICATION DEVELOPMENT ENVIRONMENT BASED ON UNITY GAME ENGINE
AIRCC Publishing Corporation
 
Game software development trends
Game software development trendsGame software development trends
Game software development trends
_veronika_
 
Unit 20 brief 1 task 2_worksheet
Unit 20 brief 1 task 2_worksheetUnit 20 brief 1 task 2_worksheet
Unit 20 brief 1 task 2_worksheet
NeilRogero
 
Generating 3 d model in virtual reality and analyzing its performance
Generating 3 d model in virtual reality and analyzing its performanceGenerating 3 d model in virtual reality and analyzing its performance
Generating 3 d model in virtual reality and analyzing its performance
ijcsit
 
Purge – First Person Shooting (FPS) Game
Purge – First Person Shooting (FPS) GamePurge – First Person Shooting (FPS) Game
Purge – First Person Shooting (FPS) Game
IRJET Journal
 
My Presentation.ppt
My Presentation.pptMy Presentation.ppt
My Presentation.ppt
Fake474384
 
CV-05.04.16
CV-05.04.16CV-05.04.16
CV-05.04.16
Theo Christodoulou
 
Edmondslideshare
EdmondslideshareEdmondslideshare
Edmondslideshare
halley_edmond
 
HTML5 Game Development frameworks overview
HTML5 Game Development frameworks overviewHTML5 Game Development frameworks overview
HTML5 Game Development frameworks overview
Abhishek Singhal [L.I.O.N]
 
Biological organism simulation using procedural growth "Organimo 1.0"
Biological organism simulation using procedural growth "Organimo 1.0"Biological organism simulation using procedural growth "Organimo 1.0"
Biological organism simulation using procedural growth "Organimo 1.0"
Devyani Singh
 
Android game ppt
Android game pptAndroid game ppt
Android game ppt
AbinashranaSingh
 
Gesture Gaming on the World Wide Web Using an Ordinary Web Camera
Gesture Gaming on the World Wide Web Using an Ordinary Web CameraGesture Gaming on the World Wide Web Using an Ordinary Web Camera
Gesture Gaming on the World Wide Web Using an Ordinary Web Camera
IJERD Editor
 
CGV Project Report.pdf
CGV Project Report.pdfCGV Project Report.pdf
CGV Project Report.pdf
HimaBindhu41
 
Surface computing by deekshita bhuyan
Surface computing by deekshita bhuyanSurface computing by deekshita bhuyan
Surface computing by deekshita bhuyan
dkshtbhuyan20
 
Surface computing by deekshita bhuyan
Surface computing by deekshita bhuyanSurface computing by deekshita bhuyan
Surface computing by deekshita bhuyan
dkshtbhuyan20
 

Similar to FIRST PERSON SHOOTER GAME UNITY 3D (20)

Accepting the Challenges in Devising Video Game Leeway and Contrivance
Accepting the Challenges in Devising Video Game Leeway and ContrivanceAccepting the Challenges in Devising Video Game Leeway and Contrivance
Accepting the Challenges in Devising Video Game Leeway and Contrivance
 
Ancient world online
Ancient world online Ancient world online
Ancient world online
 
CG_report_merged (1).pdf
CG_report_merged (1).pdfCG_report_merged (1).pdf
CG_report_merged (1).pdf
 
Road attack
Road attackRoad attack
Road attack
 
Squid Game and Music Synchronization
Squid Game and Music SynchronizationSquid Game and Music Synchronization
Squid Game and Music Synchronization
 
STUDY OF AN APPLICATION DEVELOPMENT ENVIRONMENT BASED ON UNITY GAME ENGINE
STUDY OF AN APPLICATION DEVELOPMENT ENVIRONMENT BASED ON UNITY GAME ENGINESTUDY OF AN APPLICATION DEVELOPMENT ENVIRONMENT BASED ON UNITY GAME ENGINE
STUDY OF AN APPLICATION DEVELOPMENT ENVIRONMENT BASED ON UNITY GAME ENGINE
 
Game software development trends
Game software development trendsGame software development trends
Game software development trends
 
Unit 20 brief 1 task 2_worksheet
Unit 20 brief 1 task 2_worksheetUnit 20 brief 1 task 2_worksheet
Unit 20 brief 1 task 2_worksheet
 
Generating 3 d model in virtual reality and analyzing its performance
Generating 3 d model in virtual reality and analyzing its performanceGenerating 3 d model in virtual reality and analyzing its performance
Generating 3 d model in virtual reality and analyzing its performance
 
Purge – First Person Shooting (FPS) Game
Purge – First Person Shooting (FPS) GamePurge – First Person Shooting (FPS) Game
Purge – First Person Shooting (FPS) Game
 
My Presentation.ppt
My Presentation.pptMy Presentation.ppt
My Presentation.ppt
 
CV-05.04.16
CV-05.04.16CV-05.04.16
CV-05.04.16
 
Edmondslideshare
EdmondslideshareEdmondslideshare
Edmondslideshare
 
HTML5 Game Development frameworks overview
HTML5 Game Development frameworks overviewHTML5 Game Development frameworks overview
HTML5 Game Development frameworks overview
 
Biological organism simulation using procedural growth "Organimo 1.0"
Biological organism simulation using procedural growth "Organimo 1.0"Biological organism simulation using procedural growth "Organimo 1.0"
Biological organism simulation using procedural growth "Organimo 1.0"
 
Android game ppt
Android game pptAndroid game ppt
Android game ppt
 
Gesture Gaming on the World Wide Web Using an Ordinary Web Camera
Gesture Gaming on the World Wide Web Using an Ordinary Web CameraGesture Gaming on the World Wide Web Using an Ordinary Web Camera
Gesture Gaming on the World Wide Web Using an Ordinary Web Camera
 
CGV Project Report.pdf
CGV Project Report.pdfCGV Project Report.pdf
CGV Project Report.pdf
 
Surface computing by deekshita bhuyan
Surface computing by deekshita bhuyanSurface computing by deekshita bhuyan
Surface computing by deekshita bhuyan
 
Surface computing by deekshita bhuyan
Surface computing by deekshita bhuyanSurface computing by deekshita bhuyan
Surface computing by deekshita bhuyan
 

Recently uploaded

Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Diana Rendina
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
S. Raj Kumar
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 

Recently uploaded (20)

Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 

FIRST PERSON SHOOTER GAME UNITY 3D

  • 1. 3D GAME APPLICATION BASED ON FIRST PERSON CONTROLLER PROJECT REPORT SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENT FOR THE DEGREE OF BACHELOR OF SCIENCE IN COMPUTER SCIENCE Manonmaniam Sundaranar University Tirunelveli Submitted by ROHITH. G S (15402676) Under the Guidance of Mrs. P. GEETHA, MCA, M.E DEPARTMENT OF COMPUTER SCIENCE MUSLIM ARTS COLLEGE THIRUVITHANCODE 2017- 2018
  • 2. Department of Computer Science Muslim Arts College, Thiruvithancode (Affiliated to Manonmaniam Sundaranar University, Tirunelveli) BONAFIDE CERTIFICATE This is to certify that the dissertation entitled “3D GAME APPLICATION BASED ON FIRST PERSON CONTROLLER IN UNITY ENGINE WITH C# AND JAVA SCRIPT” has been carried out by student ROHITH.GS under my supervision in partial fulfilment of the degree of Bachelor of science in computer Science department of Manonmaniam Sundaranar University, Tirunelveli during the academic year of 2017-2018. Internal Guide Mrs.P,Geetha,MCA,M.E Department of Computer Science Muslim Arts College, Thiruvithancode Head of Department Mrs. J. P Medlin Julia, MCA, M. Phil, M.ED Department of Computer Science Muslim Arts College, Thiruvithancode Submitted for Vice-Voice Examination held at Muslim Arts College Thiruvithancode on ………… External Examiner 1. 2.
  • 3. DECLARATION I hereby declare this project entitled “3D GAME APPLICATION BASED ON FIRST PERSON CONTROLLER” in Muslim Arts College, Thiruvithancode, submitted to Manonmaniam Sundaranar University partial fulfilment for the partial fulfilment for the requirement for the award Degree of Bachelor of Science in Computer Science during the academic year of 2017-2018, under the guidance of Mrs. P. GEETHA, MCA, M.E. Place: Thiruvithancode Hereby Date: Rohith G.S
  • 4. ACKNOWLEDGEMENT I wish to offer my sincere thanks to our Secretary Lion. H. Mohammad Ali and also to our beloved principal Prof. Dr. S. Dawn Dharma Roy, Muslim Arts College for permitting me to do this project work. I take this opportunity to express my heart full of gratitude to Mrs. J. P. Medlin Julia, MCA, M.Phil., M.Ed., Head of the Department of Computer Science, Muslim Arts College, Thiruvithancode, for allow me to do this project with all necessary facilities. I take this opportunity to express my profound thanks and deep sense of gratitude to My Guide Mrs. P. Geetha, MCA, M.E, who was behind the scene in every phase providing her masterly guidance, valuable and timely suggestions and advice which helped me to the project. I extend my thanks to my parents, programmers and my dear friends for their cooperation and constant encouragement rendered to make our project successful one. I also like to thank almighty God, who is the source of Knowledge for helping me, give strength and support to me to accomplish this work successfully. With Sincere Thanks, Rohith G.S
  • 5. ABSTRACT I was focusing on developing a “3D GAME APPLICATION BASED ON FIRST PERSON CONTROLLER”. Including game scenario design, playing method design, game passed condition, the enemy AI intelligent system logic design and energy system design. Meanwhile the main implementation technologies of the game are introduced here by the mainstream Unity3D engine. Practice shows that a picture lifelike realism, movements’ smooth game works can be efficiently made using the unity3D engine. Unity game engine is more object-based coding structure to develop this game I use two scripting languages c# and JavaScript it works as the backend. Mostly I prefer c# as the first language to study because it is easier to code. The thesis will cover the implementation of real-time Graphics, Physics Engine, Network support, as well as sound effect and background music.
  • 6. DECLARATION I hereby declare this project entitled “3D GAME APPLICATION BASED ON FIRST PERSON CONTROLLER” in Muslim Arts College, Thiruvithancode, submitted to Manonmaniam Sundaranar University partial fulfilment for the partial fulfilment for the requirement for the award Degree of Bachelor of Science in Computer Science during the academic year of 2017-2018, under the guidance of Mrs. P. GEETHA, MCA, M.E. Place: Thiruvithancode Hereby Date: Rohith G.S
  • 7.
  • 8. 1 1.INTRODUCTION The project is an implementation of 3D GAME APPLICATION BASED ON FIRST PERSON CONTROLLER IN UNITY ENGINE WITH C# AND JAVASCRIPT. Making game is a complicated subject when the big studios create games they do so in large teams each person has a specific role will that be 3d modelling programming doing concept art by some design in reality though most people don’t start with a professional while just a single laptops with good ideas lets at least how I got into it. Every video games run on what is called a game engine the engine is what tells the components in the computer stuff like how to render graphics or play audio games such as half-life 2, counter strike these are run on the source engine but most of the game is common when it’s came to physics graphics and game play previously these game studios would have to spend a huge amount of work to creating game engine or purchase an existing one from other studios which was not cheap but these days a lot of independent engines have been made with sole purpose of people using them to build his own game . unity is an engine allow you to create both 2d and 3d games that can be also exported to variety of platforms. unity is the start up for all the beginner’s because it is not much complicated .unreal engine is the most advanced game engine for more experienced developers who are looking to create a good graphical game . Some requirement for the computer where given from the beginning, such as: 3D graphics –the game must contain 3d models and render these in the game .3D environments where never a requirement and platform game with the 2D environment could still open up for 3D objects. Impressive result – the game result must impress whoever play the game .and think the player to do it in over and over. Graphical effect –to achieve an impressive result we need a good graphical quality such as real-time renders, soft shadows, motion blur etc. Working with these requirements i decided to use unity 3D as my platform to develop my game with. This decision was made with regarded to that a platform had many inbuilt tools and provide a good framework for us to get started with development as faster as can. like project like web designing there have two separation front end backend frontend is nothing but type of designs are used impress clients
  • 9. 2 and backend is used to add functionality to the front end items .similarly in my project have front end and backend .in front end I use 3d object models that are created in different modelling software such as 3DSMAX, BLENDER, CENEMA 4D,MAKE HUMAN etc. and also it can used to animate a particular object in my game I use little bit animation because it is extremely complicated one we need a lot of time to animate each and every part of animated character .For some of the sounds effect, I use Adobe Audition and audacity.
  • 10. 3 2.SYSTEM REQUIREMENTS 2.1 HARDWARE SPECIFICATION • PROCESSOR : Intel i5 7th gen kaby lake processor • HARD DRIVE : 1 TB • RAM :8 GB DDR5 • GRAPHICS CARD : DUAL GRAPHICS CARD NVEDA GEFORCE GTX 940MX 4GB DEDICATED & Intel IRIS 620 INTEGRATED • RESOLUTION : 1920*1080 FULL HD IPS PANNEL ANTI-GLARE DISPLAY • MOUSE : OPTICAL MOUSE& PRECISION TOUCHPAD • 2ND DISPLAY : ACER MONITOR 2.2 SOFTWARE SPECIFICATION • OPERATING SYSTEM : WINDOW 10 HOME (X64) • BUILD WITH : UNITY 5 5.6.4 • DOCUMENTATION : MS WORD 2010
  • 11. 4 3.SOFTWARE DESCRIPTION 3.1 ABOUT OPERATING SYSTEM Windows 10 is a personal computer operating system developed and released by Microsoft as part of the Windows NT family of operating systems. It was released on July 29, 2015. It is the first version of Windows that receives on going feature updates. Devices in enterprise environments can receive these updates at a slower pace or use long-term support milestones that only receive critical updates, such as security patches, over their ten-year lifespan of extended support. Windows 10 introduces what Microsoft described as "universal apps" expanding on Metro-style apps, these apps can be designed to run across multiple Microsoft product families with nearly identical code—including PCs, tablets, smartphones, embedded systems, Xbox One, Surface Hub and Mixed Reality. The Windows user interface was revised to handle transitions between a mouse- oriented interface and a touchscreen-optimized interface based on available input devices— particularly on 2-in-1 PCs both interfaces include an updated Start menu which incorporates elements of Windows 7's traditional Start menu with the tiles of Windows 8. The first release of Windows 10 also introduces a virtual desktop system, a window and desktop management feature called Task View, the Microsoft Edge web browser, support for fingerprint and face recognition login, new security features for enterprise environments, and DirectX 12 and WDDM 2.0 to improve the operating system's graphics capabilities for games. 3.2 USER INTERFACE A new iteration of the Start menu is used on the Windows 10 desktop, with a list of places and other options on the left side, and tiles representing applications on the right. The menu can be resized, and expanded into a full-screen display, which is the default option in Tablet mode. A new virtual desktop system was added. A feature known as Task View displays all open windows and allows users to switch between them, or switch between multiple workspaces. Windows Store apps, which
  • 12. 5 previously could be used only in full screen mode, can now be used in self-contained windows similarly to other programs. Program windows can now be snapped to quadrants of the screen by dragging them to the corner. When a window is snapped to one side of the screen, Task View appears and the user is prompted to choose a second window to fill the unused side of the screen (called "Snap Assist"). Windows' system icons were also changed. Charms have been removed their functionality in Windows Store apps is accessed from an App commands menu on their title bar. In its place is Action Centre, which displays notifications and settings toggles. It is accessed by clicking an icon in the notification area or dragging from the right of the screen. Notifications can be synced between multiple devices. The Settings app (formerly PC Settings) was refreshed and now includes more options that were previously exclusive to the desktop Control Panel Windows 10 is designed to adapt its user interface based on the type of device being used and available input methods. It offers two separate user interface modes: a user interface optimized for mouse and keyboard, and a "Tablet mode" designed for touchscreens. Users can toggle between these two modes at any time, and Windows can prompt or automatically switch when certain events occur, such as disabling Tablet mode on a tablet if a keyboard or mouse is plugged in, or when a 2-in-1 PC is switched to its laptop state. In Tablet mode, programs default to a maximized view, and the taskbar contains a back button and hides buttons for opened or pinned programs; Task View is used instead to switch between programs. The full screen Start menu is used in this mode, similarly to Windows 8, but scrolls vertically instead of horizontally. 3.3 C#SCRIPTING Scripts, known in Unity as behaviours, let you take assets in your scene and make them interactive. Multiple scripts can be attached to a single object, allowing for easy code reuse. Unity supports three different programming languages; UnityScript, C#, and Boo.
  • 13. 6 UnityScript is similar to JavaScript and ActionScript, C# is similar to Java, and Boo is similar to Python. Depending on your background you may feel more comfortable with one or the other. Let’s create a C# script: 1. Click Assets > Create > New C# Script 2. Rename the new script in the Project panel to PlayerScript 3. Double click the script to open it in MonoDevelop The script should look just like this: 01 02 03 04 05 06 07 08 09 10 11 12 using UnityEngine; using System.Collections; public class PlayerScript : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { } } C# class names must be the same as their file name and are case sensitive. Make sure your class name matches the file name exactly, excluding the file extension. All scripts have a start () method and an update() method. The start () method is run once when the object is first created, while the update () method runs once per frame. Our script needs to be constantly checking for arrow keys being pressed, so we’ll add the following code to the update() method.
  • 14. 7 4.PROJECT DESCRIPTION In this project we were left free to decide what type of game we want to develop the suggestion was that an Adventure action game is suitable since such a game usually does not depend on advanced assets e.g. animated models. After some confusion, I decided to create this game. To further explain how the game concept evolved the development has been divided into two parts. INITIAL CONCEPT My initial concept is similar to the combination of games like IGI2 and GTA vice city but I change my behaviour in games I try to create a unique from those two because these games already prove that it totally differs from other graphical games so I need to create a unique and better one. In my game I have a player is fully loaded with weapons he can access anything on the ground he can access and drive the car without permission I provide so many levels to complete the mission. another idea was to create a big island for the player. In this game, the player did not show up her face because it is a first-person shooter game if you start playing you are the person to play the game we have seen two hands with a fully loaded weapon FINAL CONCEPT I collect so many ideas from the internet from variety of resources and did not follow any development process because each time executing development face so many challenges in both designing and coding so I need to look up from in its beginning .i compromised a lot of subjects because I have not enough time and bright knowledge about all functions in the unity engine each and every time I got new ideas for the game but don’t know to do that so I take too much time for data collection and study them. DEVELOPMENT PROCESS In a software development project, the resulting product is required to fulfil many different qualities. Example of such quality requirements is: Availability, Maintainability, Dependability, and usability .to meet such varying demands, it is important to base the work on a well-prepared strategy. In software engineering, the term for such a strategy is commonly known as a software process, which is built a software process models.
  • 15. 8 A software process model is a theoretical philosophy that describes the best way of developing software. Based on one or several models, a software process is formed providing guidance on how to operate. A software process model may also be described as an abstract representation of a software process. the concept of the process model is similar to an abstract Java class, which cannot be instantiated, but it can be implemented by another class, thus providing basic guidelines for that other class. A model may, for example, demand customer involvement, but it does not state exactly how .a process implementing that model should involve the customer in the process activities but is free to choose how. I use a software development process called Agile SDLC model. It is a combination of iterative and incremental process models with a focus on process adaptability and customer satisfaction by rapid delivery of working software product. Agile Methods break the product into small incremental builds. These builds are provided in iterations. Each iteration typically lasts from about one to three weeks. Every iteration involves cross- functional teams working simultaneously on various areas like − • Planning • Requirements Analysis • Design • Coding • Testing At the end of the iteration, a working product is displayed to the customer and important stakeholders. Agile model believes that every project needs to be handled differently and the existing methods need to be tailored to best suit the project requirements. In Agile, the tasks are divided into time boxes (small time frames) to deliver specific features for a release. An iterative approach is taken and working software build is delivered after each iteration. Each build is incremental in terms of features; the final build holds all the features required Here is a graphical illustration of the Agile Model
  • 16. 9 4.1 GAME ENGINE A game engine is a framework for game development this framework helps us in several core areas that all games have it can simplify it to just three Graphics ,Audio and Logic actually these are thing that all software has however modern game engine have become more specialized and commonly include framework for physics ,AI, networking ,Optimization and much more . let’s take a look at some basic functionality that most users are familiar with the most important is the rendering engine or render this is responsible for taking codes from a programmer and translating it to form of object in game environment based on your perspective in the game environment the render will project that the image on the screen depending on the characteristic of the object a render will determine its attributes . Modern game engines also control game lighting they simulate how light reflected in the game world and creates shadow from that because it takes lot of power to precisely render
  • 17. 10 individual light particles object interaction is controlled by physics engine this is responsible for the stimulation of certain physical systems such as rigid body dynamics ,fluid dynamics and soft body dynamics Artificial intelligence or AI the point is stimulate human like intelligence in characters not controlled by the player this includes walking around the gaming world not running into the walls hiding .Without AI characters and game would be standing the entire time doing nothing there are many types of artificial intelligence some of they are talking to some other of each character in the game or walk from point A to point B etc.. UNITY 3D Unity is cross-platform game engine developed by unity technologies and used to develop video games for pc, consoles, mobile devices and websites. first announced only for Apple OS and later it comes to all other platforms Unity is a multipurpose game engine that supports 2D and 3D graphics, drag-and- drop functionality, and processing using C#. Two other programming languages were supported which was deprecated with the release of Unity 5 and JavaScript which started its deprecation process in August 2017 after the release of Unity 2017The engine targets the following graphics APIs: Direct3D on Windows and Xbox One; OpenGL on Linux, macOS, and Windows. on Android and iOS, WebGL on the web; and proprietary APIs on the video game consoles. Additionally, Unity supports the low-level APIs Metal on iOS and macOS and Vulkan on Android, Linux, and Windows, as well as Direct3D on Windows and Xbox One. Within 2D games, Unity allows importation of sprites and an advanced 2D world renderer. For 3D games, Unity allows specification of texture compression, maps, and resolution settings for each platform that the game engine supports, and provides support for bump mapping, reflection mapping, parallax mapping, screen space ambient occlusion (SSAO), dynamic shadows using shadow maps, render-to-texture, and full-screen post- processing effects. Unity also offers services to developers, these are Unity Ads, Unity Analytics, Unity Certification, Unity Cloud Build, Unity Every play, Unity IAP, Unity Multiplayer, Unity Performance Reporting and Unity Collaborate.
  • 18. 11 Here is a graphical illustration of the Unity Game engine 4.2 BASIC CONCEPT Coordinate Space Three axes X, Y, Z -based on the Cartesian coordinate system Hierarchy The Hierarchy contains every Game Object in the current Scene. Some of these are direct instances of asset files like 3D models, and others are instances of Prefabs, custom objects that will make up much of your game. You can select objects in the Hierarchy and drag one object onto another to make use of parenting (see below). As objects are added and removed in the scene, they will appear and disappear from the Hierarchy as well.
  • 19. 12 Parenting Unity uses a concept called Parenting. To make any Game Object the child of another, drag the desired child onto the desired parent in the Hierarchy. A child will inherit the movement and rotation of its parent. You can use a parent object’s foldout arrow to show or hide its children as necessary. Toolbars
  • 20. 13 The Toolbar consists of five basic controls. Each relate to different parts of the Editor. Transform Tools – used with the Scene View Play/Pause/Step Buttons – used with the Game View Play/Pause/Step Buttons – used with the Game View Layout Drop-down – controls arrangement of all Views Scene View The Scene View is your interactive sandbox. You will use the Scene View to select and position environments, the player, the camera, enemies, and all other Game Objects. Manipulating objects within the Scene View are some of the most important functions in Unity, so it’s important to be able to do them quickly. To this end, Unity provides keystrokes for the most common operations. See Scene View Navigation for full details on navigating the scene view. Here’s a brief overview of the essentials: Hold the right mouse button to enter Flythrough mode. This turns your mouse and WASD keys (plus Q and E for up and down) into quick first-person view navigation.
  • 21. 14 Select any Game Object and press the F key. This will centre the Scene View and pivot point on the selection. Use the arrow keys to move around on the X/Z plane. Hold Alt and click-drag to orbit the camera around the current pivot point. Hold Alt and middle click-drag to drag the Scene View camera around. Hold Alt and right click-drag to zoom the Scene View. This is the same as scrolling with your mouse wheel. You might also find use in the Hand Tool (shortcut: Q), especially if you are using a one-button mouse. With the Hand tool selected: Click- drags to drag the camera around. Hold Alt and click-drag to orbit the camera around the current pivot point. Hold Alt and right click-drag to zoom the Scene View. On Mac you can also hold Control and click-drag instead. In the upper-right corner of the Scene View is the Scene Gizmo. This displays the Scene Camera’s current orientation and allows you to quickly modify the viewing angle.
  • 22. 15 Each of the coloured “arms” of the gizmo represents a geometric axis. You can click on any of the arms to set the camera to an orthographic (i.e. perspective-free) view looking along the corresponding axis. You can click on the text underneath the gizmo to switch between the normal perspective view and an isometric view. While in isometric mode, you can right-click drag to orbit, and Alt + middle-click drag to pan. Note that the Scene Gizmo will be hidden when the view is in 2D mode, since the view is always directly at the XY plane. Game view The Game View is rendered from the Camera(s) in your game. It is representative of your final, published game. You will need to use one or more Cameras to control what the player actually sees when they are playing your game. Inspector Games in Unity are made up of multiple Game Objects that contain meshes, scripts, sounds, or other graphical elements like Lights. The Inspector displays detailed information about your currently selected Game Object, including all attached Components and their properties. Here, you modify the functionality of Game Objects in your scene. Any property that is displayed in the Inspector can be directly modified. Even script variables can be changed without modifying the script itself. You can use the Inspector to change variables at runtime to experiment and find the magic gameplay for your game. In a script, if you define a public variable of an object type (like Game object or Transform).
  • 23. 16 4.3 DESIGNING AND MODELING Environment Creation Every game need a basement for the player to follow the game so first we create a terrain (ground) it can be created by using 3rd party software or it can done in side unity.Click on Game Object> Create other >Create terrain .First terrain have a default size so we can adjusted it in the inspector window go to the transformation adjust the X and scaling to 1500, 1500 don’t modify the Z axis .The change the view to top view so we can see the full region Now raise/low terrain tool in the inspector window (make sure that the terrain selected in hierarchy window) I can simply draw on the top view of the ground plane in the scene window to create certain terrain features. I used Brush size 70 and opacity 90 to make big peaks like mountain an I reduce its size to 30 and draw small ground peaks if any mistake are done press ctrl+z to undo the operation
  • 24. 8 A software process model is a theoretical philosophy that describes the best way of developing software. Based on one or several models, a software process is formed providing guidance on how to operate. A software process model may also be described as an abstract representation of a software process. the concept of the process model is similar to an abstract Java class, which cannot be instantiated, but it can be implemented by another class, thus providing basic guidelines for that other class. A model may, for example, demand customer involvement, but it does not state exactly how .a process implementing that model should involve the customer in the process activities but is free to choose how. I use a software development process called Agile SDLC model. It is a combination of iterative and incremental process models with a focus on process adaptability and customer satisfaction by rapid delivery of working software product. Agile Methods break the product into small incremental builds. These builds are provided in iterations. Each iteration typically lasts from about one to three weeks. Every iteration involves cross- functional teams working simultaneously on various areas like − • Planning • Requirements Analysis • Design • Coding • Testing At the end of the iteration, a working product is displayed to the customer and important stakeholders. Agile model believes that every project needs to be handled differently and the existing methods need to be tailored to best suit the project requirements. In Agile, the tasks are divided into time boxes (small time frames) to deliver specific features for a release. An iterative approach is taken and working software build is delivered after each iteration. Each build is incremental in terms of features; the final build holds all the features required Here is a graphical illustration of the Agile Model
  • 25. 18 character. They are unlike third-person shooters, in which the player can see (usually from behind) the character they are controlling. The primary design element is combat, mainly involving firearms. To create a first-person controller first create a game object go to create> game Object >capsule press f to zoom the object selected. click on capsule in hierarchy and right click and select camera then focus the camera on the front of the capsule add a capsule collider then after we add three main scripts player move script, player look script and user control script DESIGNING THE CAR MODEL For design the car required for the game, we had to sketch out the blue print which would fulfil all the requirement for the game. First, we need to go of some blue prints of the car that we want to model. I tend to use www.the-blueprint.com. Then we open 3DsMax. We started by creating the planes .in the top viewport we created a plane of any size.in the modify panel, we change the size of the plane to match the size for the car.
  • 26. 19 Now we had our first plane we needed to create 3 more. There was more than one way of doing this but we found this way is quickest. We press the snap rotation button then press the “select and rotate button”. Then we had the 4 plane set up, we wanted to add the blueprints to them .weapons the material window .then click the small box to diffuse which open a new window double click and “open file” window. Then we had our blue print in 3DsMax changed the name of the material. we repeated this for each view. Once we had all four images in 3DsMax we made sure the “visible view port” was clicked on. We choose the plane we want to add the image to and clicked “Add Material to Selected”. Our screen should look similar to the one below. We did this for all planes. After this was done we selected all four Plane and right clicked, then we choose “object properties “to open a new window. Then we unchecked “Show Frozen in Grey” and render able. Next, we checked “Blackface cull”. Then we converted it into all four planes to editable polygon After selecting one plane (front)and we checked the “preserve UVs”box (right).This allowed us to move edges of the plane without affecting the image. Then we changed the sub object model to selected edge. On the side view of the car we select the top edge and moved it down until no white remained. We were careful not to cut off top of the car
  • 27. 20 Once our plane had no white borders it was time to move into position. using the “select and move” tool we moved the side view back to the edge of the top view. The front and back views went to either end of the top view .Then we moved the top view down to the bottom of the side view. Then we selected all planes, right clicked and selected “free selection”. Save the file and completed modelling. Designing Enemy To create an enemy first create a humanoid character. for this creation I use an application called make human it provides a human model are already there and we can modify it change colour change the sex change the mass add muscle
  • 28. 12 Parenting Unity uses a concept called Parenting. To make any Game Object the child of another, drag the desired child onto the desired parent in the Hierarchy. A child will inherit the movement and rotation of its parent. You can use a parent object’s foldout arrow to show or hide its children as necessary. Toolbars
  • 29. 22 Save the project and click on export button select mesh format as wave front .obj Animation is the lot more complicated subject .so simplify the task I use a trick .I use a website called mixamo.com this website is help us to add commonly seen animation in easy way .import the character was created and select the joints press ok button the Rig detection was completed and now seen a lot of animation available for the character I select 3 single animations (idle, run, attack).
  • 30. 23 Now main modelling works are completed. I use so many models to create this game most of them are not movable objects that are not covered because it take too much time to explain about each and every small and large models so I skip that section HOLDING GUN ON HANDS To add a holding hand so we use the make human software and create a character by skipping the cloth section because we need only both hands other parts are not usable make sure that we select the pose /animation and set to default. save in. mhx2 format. open the blender software and import the created character some times in blender not show the mhx2 format to import so we go to preferences>add-ons>in the search box type make human two checkbox will appear select the first one.
  • 31. 24 Go to the file menu again and import>mhx2 export. Now the model is successfully imported select the character and change the object mode to edit mode now the object will appear as editable object. Hold on the B button on key board and select the portion want to remove. press the x button to delete. Save the object in. fbx file format. other adjustments are done in c4D software open the c4d software import the file select the object and choose the root>pelvis>hand in hierarchy adjust the hands for a holding one by using the transformation tools select the bones rotate as our concept it takes too much time for perfection aster completion save in. fbx format and import to unity.
  • 32. 25 ADDING MESSAGES Adding message is lot more easy to do fist create a cube in unity and add box collider and mesh renderer from component then check the trigger option in box collider now we can move over the cube .Then create a canvas by click on create>game object>cube adjust the cube with transform tool select the canvas in hierarchy right click on the canvas and add image adjust the image size to (width)80,(height)20.Add the c# message script. Drag and drop the created jpg image to the script. SPLASH SCREEN Splash screen is used in the beginning of the game to introduce the game or to terminate one scene to another one scene without any disturbance it can also use to show a level was completed or failed .the technique is quite easy it can done though script we reduce and enhance the alpha colour values .fist we remove the directional light and set skybox colour to black create a canvas and add a image adjust the size to 1920*1080 it is my screen resolution. Message
  • 33. 26 4.4Event Functions Used As a Script executes within Unity, there are several 'Event Functions' which are called in a specific order. You can use them control the behaviour of your game. Let's have look at the most popular ones, in order of execution, when starting within Unity: Event Function: ‘Awake ()' The ‘Awake ()' function is always called before any Start functions and also just after a prefab is instantiated. Event Function: ‘Start ()' The ‘Start ()' function is called before the first frame update only if the script instance is enabled. Event Function: ‘Update ()' The 'Update()' function is called every frame that the game is rendered, i.e. if your frame rate is 30fps (frames per second) then the function will be called 30 times per second. You should place most of your behaviour code within this function, except anything which involves physics. It is worth noting that the Unity Player's frame rate can fluctuate at runtime, depending on the hardware it's running on and the computing required per frame. It is therefore crucial that your code within this function is as optimized as possible. Event Function: ‘Late Update ()' The ‘Late Update ()' function is called once per frame, after the ‘Update ()' function has finished. Any calculations that are performed in Update () will have completed when Late Update() begins.
  • 34. 27 Event Function: 'Fixed Update ()' The 'Fixed Update ()' function is called within each physics step; it will keep in sync with Unity's physics engine. The code within this function should also be as optimized as possible. Event Handler Function: ‘OnApplicationQuit ()' The 'OnApplicationQuit' function is actually defined as an Event Handler; all Event Handlers begin with 'On'. It is called on all game objects when the application is quit. In the editor it is called when the user stops play mode. In the web player it is called when the web view is closed.You can find more information about the Execution Order and the Update Order within the Unity Manual PHYSICS FUNCTIONS COLLIDERS Colliders are what physics engines use to perform hit detection. Unlike mesh objects, they know when they’ve come in contact with each other. They are simple shapes like boxes, spheres, or capsules that are assigned to your Game Objects and follow them around. You can think of them as something of a "force field". Conveniently, whenever a Game Object is created, it is automatically assigned an appropriate collider. A Cube gets a BoxCollider, a Sphere gets a SphereCollider, a Cylinder gets a CapsuleCollider, and so on RIGIDBODY A rigidbody is the the most critical element in a physics engine. Any GameObject it is attached to is included in the simulation. By default, a rigidbody is affected by gravity and air resistance, also known as drag. If we press Play, the block will start to fall, accelerate, and eventually hit terminal velocity when the force of gravity and drag equalize.
  • 35. 28 5.SOURCE CODE MOUSELOOK using UnityEngine; using System.Collections; public class MouseLook : MonoBehaviour { public enum RotationAxes { MouseXAndY = 0, MouseX = 1, MouseY = 2 } public RotationAxes axes = RotationAxes.MouseXAndY; public float sensitivityX = 15F; public float sensitivityY = 15F; public float minimumX = -360F; public float maximumX = 360F; public float minimumY = -60F; public float maximumY = 60F; float rotationY = 0F; void Update () { if (axes == RotationAxes.MouseXAndY) { float rotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivityX; rotationY += Input.GetAxis("Mouse Y") * sensitivityY; rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);
  • 36. 29 transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0); } else if (axes == RotationAxes.MouseX) { transform.Rotate(0, Input.GetAxis("Mouse X") * sensitivityX, 0); } else { rotationY += Input.GetAxis("Mouse Y") * sensitivityY; rotationY = Mathf.Clamp (rotationY, minimumY, maximumY); transform.localEulerAngles = new Vector3(-rotationY, transform.localEulerAngles.y, 0); } } void Start () { // Make the rigid body not change rotation if (GetComponent<Rigidbody>()) GetComponent<Rigidbody>().freezeRotation = true; } } FPS INPUT CONTROLLER private var motor : CharacterMotor; // Use this for initialization function Awake () {
  • 37. 30 motor = GetComponent(CharacterMotor); } // Update is called once per frame function Update () { // Get the input vector from keyboard or analog stick var directionVector = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); if (directionVector != Vector3.zero) { // Get the length of the directon vector and then normalize it // Dividing by the length is cheaper than normalizing when we already have the length any way var directionLength = directionVector.magnitude; directionVector = directionVector / directionLength; // Make sure the length is no bigger than 1 directionLength = Mathf.Min(1, directionLength); // Make the input vector more sensitive towards the extremes and less sensitive in the mid dle // This makes it easier to control slow speeds when using analog sticks directionLength = directionLength * directionLength; // Multiply the normalized direction vector by the modified length directionVector = directionVector * directionLength; } // Apply the direction to the CharacterMotor motor.inputMoveDirection = transform.rotation * directionVector; motor.inputJump = Input.GetButton("Jump"); } // Require a character controller to be attached to the same game object @script RequireComponent (CharacterMotor) @script AddComponentMenu ("Character/FPS Input Controller") HEALTH SCRIPT var guiSkin : GUISkin; var text1 : Texture; var text2 : Texture; var text3 : Texture; var text4 : Texture; var healthPoints : float; var healtRegen : float; var healthRegenEnabled = true; function Update () { //Health Regen if(healthRegenEnabled == true && healthPoints < 10000) {
  • 38. 31 healthPoints += healtRegen *Time.deltaTime; } //Check for maximum health if(healthPoints > 10000) { healthPoints = 10000; } //Check for minimum health if(healthPoints <= 0) { healthPoints = 0; //healthRegenEnabled = false; Debug.Log("YOU ARE DEAD!"); } } function OnGUI () { GUI.skin = guiSkin; GUI.Label(new Rect(Screen.width - 130, Screen.height - 90, 200, 50), healthPoints.ToString ("F0")); if(healthPoints<=10000) { GUI.DrawTexture(Rect(0,0,Screen.width,Screen.height),text1); } if(healthPoints<=8000) { GUI.DrawTexture(Rect(0,0,Screen.width,Screen.height),text2); } if(healthPoints<=400) { GUI.DrawTexture(Rect(0,0,Screen.width,Screen.height),text3); } if(healthPoints<=100) { GUI.DrawTexture(Rect(0,0,Screen.width,Screen.height),text4); } } GUN SCRIPT using UnityEngine; public class Gun : MonoBehaviour { public float damage = 10f; public float range = 100f; public float impactForce= 30f; public Camera fpsCam;
  • 39. 32 public ParticleSystem muzzleflash; public GameObject impactEffect; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (Input.GetButtonDown ("Fire1")) { Shoot (); } } void Shoot() { muzzleflash.Play (); RaycastHit hit; if (Physics.Raycast (fpsCam.transform.position, fpsCam.transform.forward, out hit, range)) { Debug.Log (hit.transform.name); Target target= hit.transform.GetComponent<Target>(); if (target != null) { target.TakeDamage (damage); } if (hit.rigidbody != null) { hit.rigidbody.AddForce (-hit.normal * impactForce); } GameObject impactGO =Instantiate (impactEffect, hit.point, Quaternion.LookRotation (hit. normal)); Destroy (impactGO, 2f); } } } AUDIO SCRIPT using System.Collections; using System.Collections.Generic; using UnityEngine; public class audio : MonoBehaviour { // Use this for initialization void Start () { }
  • 40. 18 character. They are unlike third-person shooters, in which the player can see (usually from behind) the character they are controlling. The primary design element is combat, mainly involving firearms. To create a first-person controller first create a game object go to create> game Object >capsule press f to zoom the object selected. click on capsule in hierarchy and right click and select camera then focus the camera on the front of the capsule add a capsule collider then after we add three main scripts player move script, player look script and user control script DESIGNING THE CAR MODEL For design the car required for the game, we had to sketch out the blue print which would fulfil all the requirement for the game. First, we need to go of some blue prints of the car that we want to model. I tend to use www.the-blueprint.com. Then we open 3DsMax. We started by creating the planes .in the top viewport we created a plane of any size.in the modify panel, we change the size of the plane to match the size for the car.
  • 41. 34 SelectedWeapon++; } if(Input.GetAxis("Mouse ScrollWheel") < 0f) { if (SelectedWeapon <= 0 ) SelectedWeapon = transform.childCount - 1; else SelectedWeapon--; } if (Input.GetKeyDown (KeyCode.Alpha1)) { SelectedWeapon = 0; } if (Input.GetKeyDown (KeyCode.Alpha2) && transform.childCount >=2) { SelectedWeapon = 1; } if (Input.GetKeyDown (KeyCode.Alpha2) && transform.childCount >=3) { SelectedWeapon = 2; } if (Input.GetKeyDown (KeyCode.Alpha2) && transform.childCount >=4) {
  • 42. 35 SelectedWeapon = 3; } if(previousSelectedWeapon!=SelectedWeapon) { SelectWeapon (); } } void SelectWeapon() { int i = 0; foreach (Transform weapon in transform) { if (i == SelectedWeapon) weapon.gameObject.SetActive (true); else weapon.gameObject.SetActive (false); i++; } } } CAR SCRIPT CAR CONTROLLER using System; using UnityEngine; namespace UnityStandardAssets.Vehicles.Car { internal enum CarDriveType { FrontWheelDrive, RearWheelDrive,
  • 43. 36 FourWheelDrive } internal enum SpeedType { MPH, KPH } public class CarController : MonoBehaviour { [SerializeField] private CarDriveType m_CarDriveType = CarDriveType.FourWheelDrive; [SerializeField] private WheelCollider[] m_WheelColliders = new WheelCollider[4]; [SerializeField] private GameObject[] m_WheelMeshes = new GameObject[4]; [SerializeField] private WheelEffects[] m_WheelEffects = new WheelEffects[4]; [SerializeField] private Vector3 m_CentreOfMassOffset; [SerializeField] private float m_MaximumSteerAngle; [Range(0, 1)] [SerializeField] private float m_SteerHelper; // 0 is raw physics , 1 the car will g rip in the direction it is facing [Range(0, 1)] [SerializeField] private float m_TractionControl; // 0 is no traction control, 1 is full interference [SerializeField] private float m_FullTorqueOverAllWheels; [SerializeField] private float m_ReverseTorque; [SerializeField] private float m_MaxHandbrakeTorque; [SerializeField] private float m_Downforce = 100f; [SerializeField] private SpeedType m_SpeedType; [SerializeField] private float m_Topspeed = 200; [SerializeField] private static int NoOfGears = 5; [SerializeField] private float m_RevRangeBoundary = 1f; [SerializeField] private float m_SlipLimit; [SerializeField] private float m_BrakeTorque; private Quaternion[] m_WheelMeshLocalRotations; private Vector3 m_Prevpos, m_Pos; private float m_SteerAngle; private int m_GearNum; private float m_GearFactor; private float m_OldRotation; private float m_CurrentTorque; private Rigidbody m_Rigidbody; private const float k_ReversingThreshold = 0.01f; public bool Skidding { get; private set; } public float BrakeInput { get; private set; } public float CurrentSteerAngle{ get { return m_SteerAngle; }} public float CurrentSpeed{ get { return m_Rigidbody.velocity.magnitude*2.23693629f; }} public float MaxSpeed{get { return m_Topspeed; }} public float Revs { get; private set; } public float AccelInput { get; private set; } // Use this for initialization private void Start() { m_WheelMeshLocalRotations = new Quaternion[4];
  • 44. 37 for (int i = 0; i < 4; i++) { m_WheelMeshLocalRotations[i] = m_WheelMeshes[i].transform.localRotation; } m_WheelColliders[0].attachedRigidbody.centerOfMass = m_CentreOfMassOffset; m_MaxHandbrakeTorque = float.MaxValue; m_Rigidbody = GetComponent<Rigidbody>(); m_CurrentTorque = m_FullTorqueOverAllWheels - (m_TractionControl*m_FullTorqueOverAllWheels); } private void GearChanging() { float f = Mathf.Abs(CurrentSpeed/MaxSpeed); float upgearlimit = (1/(float) NoOfGears)*(m_GearNum + 1); float downgearlimit = (1/(float) NoOfGears)*m_GearNum; if (m_GearNum > 0 && f < downgearlimit) { m_GearNum--; } if (f > upgearlimit && (m_GearNum < (NoOfGears - 1))) { m_GearNum++; } } // simple function to add a curved bias towards 1 for a value in the 0-1 range private static float CurveFactor(float factor) { return 1 - (1 - factor)*(1 - factor); } // unclamped version of Lerp, to allow value to exceed the from-to range private static float ULerp(float from, float to, float value) { return (1.0f - value)*from + value*to; } private void CalculateGearFactor() { float f = (1/(float) NoOfGears); // gear factor is a normalised representation of the current speed within the current gear's r ange of speeds. // We smooth towards the 'target' gear factor, so that revs don't instantly snap up or down when changing gear. var targetGearFactor = Mathf.InverseLerp(f*m_GearNum, f*(m_GearNum + 1), Mathf.Abs(
  • 45. 19 Now we had our first plane we needed to create 3 more. There was more than one way of doing this but we found this way is quickest. We press the snap rotation button then press the “select and rotate button”. Then we had the 4 plane set up, we wanted to add the blueprints to them .weapons the material window .then click the small box to diffuse which open a new window double click and “open file” window. Then we had our blue print in 3DsMax changed the name of the material. we repeated this for each view. Once we had all four images in 3DsMax we made sure the “visible view port” was clicked on. We choose the plane we want to add the image to and clicked “Add Material to Selected”. Our screen should look similar to the one below. We did this for all planes. After this was done we selected all four Plane and right clicked, then we choose “object properties “to open a new window. Then we unchecked “Show Frozen in Grey” and render able. Next, we checked “Blackface cull”. Then we converted it into all four planes to editable polygon After selecting one plane (front)and we checked the “preserve UVs”box (right).This allowed us to move edges of the plane without affecting the image. Then we changed the sub object model to selected edge. On the side view of the car we select the top edge and moved it down until no white remained. We were careful not to cut off top of the car
  • 46. 39 CalculateRevs(); GearChanging(); AddDownForce(); CheckForWheelSpin(); TractionControl(); } private void CapSpeed() { float speed = m_Rigidbody.velocity.magnitude; switch (m_SpeedType) { case SpeedType.MPH: speed *= 2.23693629f; if (speed > m_Topspeed) m_Rigidbody.velocity = (m_Topspeed/2.23693629f) * m_Rigidbody.velocity.normal ized; break; case SpeedType.KPH: speed *= 3.6f; if (speed > m_Topspeed) m_Rigidbody.velocity = (m_Topspeed/3.6f) * m_Rigidbody.velocity.normalized; break; } } private void ApplyDrive(float accel, float footbrake) { float thrustTorque; switch (m_CarDriveType) { case CarDriveType.FourWheelDrive: thrustTorque = accel * (m_CurrentTorque / 4f); for (int i = 0; i < 4; i++) { m_WheelColliders[i].motorTorque = thrustTorque; } break; case CarDriveType.FrontWheelDrive: thrustTorque = accel * (m_CurrentTorque / 2f); m_WheelColliders[0].motorTorque = m_WheelColliders[1].motorTorque = thrustTorq ue; break; case CarDriveType.RearWheelDrive: thrustTorque = accel * (m_CurrentTorque / 2f); m_WheelColliders[2].motorTorque = m_WheelColliders[3].motorTorque = thrustTorq
  • 47. 40 ue; break; } for (int i = 0; i < 4; i++) { if (CurrentSpeed > 5 && Vector3.Angle(transform.forward, m_Rigidbody.velocity) < 50f ) { m_WheelColliders[i].brakeTorque = m_BrakeTorque*footbrake; } else if (footbrake > 0) { m_WheelColliders[i].brakeTorque = 0f; m_WheelColliders[i].motorTorque = -m_ReverseTorque*footbrake; } } } private void SteerHelper() { for (int i = 0; i < 4; i++) { WheelHit wheelhit; m_WheelColliders[i].GetGroundHit(out wheelhit); if (wheelhit.normal == Vector3.zero) return; // wheels arent on the ground so dont realign the rigidbody velocity } // this if is needed to avoid gimbal lock problems that will make the car suddenly shift direct ion if (Mathf.Abs(m_OldRotation - transform.eulerAngles.y) < 10f) { var turnadjust = (transform.eulerAngles.y - m_OldRotation) * m_SteerHelper; Quaternion velRotation = Quaternion.AngleAxis(turnadjust, Vector3.up); m_Rigidbody.velocity = velRotation * m_Rigidbody.velocity; } m_OldRotation = transform.eulerAngles.y; } // this is used to add more grip in relation to speed private void AddDownForce() { m_WheelColliders[0].attachedRigidbody.AddForce(-transform.up*m_Downforce* m_WheelColliders[0].attachedRigidbody.velocity.magnitude); } // checks if the wheels are spinning and is so does three things // 1) emits particles // 2) plays tiure skidding sounds
  • 48. 41 // 3) leaves skidmarks on the ground // these effects are controlled through the WheelEffects class private void CheckForWheelSpin() { // loop through all wheels for (int i = 0; i < 4; i++) { WheelHit wheelHit; m_WheelColliders[i].GetGroundHit(out wheelHit); // is the tire slipping above the given threshhold if (Mathf.Abs(wheelHit.forwardSlip) >= m_SlipLimit || Mathf.Abs(wheelHit.sidewaysSlip ) >= m_SlipLimit) { m_WheelEffects[i].EmitTyreSmoke(); // avoiding all four tires screeching at the same time // if they do it can lead to some strange audio artefacts if (!AnySkidSoundPlaying()) { m_WheelEffects[i].PlayAudio(); } continue; } // if it wasnt slipping stop all the audio if (m_WheelEffects[i].PlayingAudio) { m_WheelEffects[i].StopAudio(); } // end the trail generation m_WheelEffects[i].EndSkidTrail(); } } // crude traction control that reduces the power to wheel if the car is wheel spinning too much private void TractionControl() { WheelHit wheelHit; switch (m_CarDriveType) { case CarDriveType.FourWheelDrive: // loop through all wheels for (int i = 0; i < 4; i++) { m_WheelColliders[i].GetGroundHit(out wheelHit); AdjustTorque(wheelHit.forwardSlip); } break; case CarDriveType.RearWheelDrive: m_WheelColliders[2].GetGroundHit(out wheelHit); AdjustTorque(wheelHit.forwardSlip);
  • 49. 42 m_WheelColliders[3].GetGroundHit(out wheelHit); AdjustTorque(wheelHit.forwardSlip); break; case CarDriveType.FrontWheelDrive: m_WheelColliders[0].GetGroundHit(out wheelHit); AdjustTorque(wheelHit.forwardSlip); m_WheelColliders[1].GetGroundHit(out wheelHit); AdjustTorque(wheelHit.forwardSlip); break; } } private void AdjustTorque(float forwardSlip) { if (forwardSlip >= m_SlipLimit && m_CurrentTorque >= 0) { m_CurrentTorque -= 10 * m_TractionControl; } else { m_CurrentTorque += 10 * m_TractionControl; if (m_CurrentTorque > m_FullTorqueOverAllWheels) { m_CurrentTorque = m_FullTorqueOverAllWheels; } } } private bool AnySkidSoundPlaying() { for (int i = 0; i < 4; i++) { if (m_WheelEffects[i].PlayingAudio) { return true; } } return false; } } } CAR USER CONTROLLER using System; using UnityEngine;
  • 50. 43 using UnityStandardAssets.CrossPlatformInput; namespace UnityStandardAssets.Vehicles.Car { [RequireComponent(typeof (CarController))] public class CarUserControl : MonoBehaviour { private CarController m_Car; // the car controller we want to use private void Awake() { // get the car controller m_Car = GetComponent<CarController>(); } private void FixedUpdate() { // pass the input to the car! float h = CrossPlatformInputManager.GetAxis("Horizontal"); float v = CrossPlatformInputManager.GetAxis("Vertical"); #if !MOBILE_INPUT float handbrake = CrossPlatformInputManager.GetAxis("Jump"); m_Car.Move(h, v, v, handbrake); #else m_Car.Move(h, v, v, 0f); #endif } } } CAR SOUND namespace UnityStandardAssets.Vehicles.Car { [RequireComponent(typeof (CarController))] public class CarAudio : MonoBehaviour { // This script reads some of the car's current properties and plays sounds accordingly. // The engine sound can be a simple single clip which is looped and pitched, or it // can be a crossfaded blend of four clips which represent the timbre of the engine // at different RPM and Throttle state. // the engine clips should all be a steady pitch, not rising or falling. // when using four channel engine crossfading, the four clips should be: // lowAccelClip : The engine at low revs, with throttle open (i.e. begining acceleration at very l ow speed) // highAccelClip : Thenengine at high revs, with throttle open (i.e. accelerating, but almost at max speed) // lowDecelClip : The engine at low revs, with throttle at minimum (i.e. idling or engine-
  • 51. 44 braking at very low speed) // highDecelClip : Thenengine at high revs, with throttle at minimum (i.e. engine- braking at very high speed) // For proper crossfading, the clips pitches should all match, with an octave offset between low and high. public enum EngineAudioOptions // Options for the engine audio { Simple, // Simple style audio FourChannel // four Channel audio } public EngineAudioOptions engineSoundStyle = EngineAudioOptions.FourChannel;// Set th e default audio options to be four channel public AudioClip lowAccelClip; // Audio clip for low acceleration public AudioClip lowDecelClip; // Audio clip for low deceleration public AudioClip highAccelClip; // Audio clip for high acceleration public AudioClip highDecelClip; // Audio clip for high deceleration public float pitchMultiplier = 1f; // Used for altering the pitch of audio c lips public float lowPitchMin = 1f; // The lowest possible pitch for the low sounds public float lowPitchMax = 6f; // The highest possible pitch for the lo w sounds public float highPitchMultiplier = 0.25f; // Used for altering the pitch of hig h sounds public float maxRolloffDistance = 500; // The maximum distance where r ollof starts to take place public float dopplerLevel = 1; // The mount of doppler effect used in t he audio public bool useDoppler = true; // Toggle for using doppler private AudioSource m_LowAccel; // Source for the low acceleration sounds private AudioSource m_LowDecel; // Source for the low deceleration sounds private AudioSource m_HighAccel; // Source for the high acceleration sounds private AudioSource m_HighDecel; // Source for the high deceleration sounds private bool m_StartedSound; // flag for knowing if we have started sounds private CarController m_CarController; // Reference to car we are controlling private void StartSound() { // get the carcontroller ( this will not be null as we have require component) m_CarController = GetComponent<CarController>(); // setup the simple audio source m_HighAccel = SetUpEngineAudioSource(highAccelClip); // if we have four channel audio setup the four audio sources if (engineSoundStyle == EngineAudioOptions.FourChannel) { m_LowAccel = SetUpEngineAudioSource(lowAccelClip);
  • 52. 45 m_LowDecel = SetUpEngineAudioSource(lowDecelClip); m_HighDecel = SetUpEngineAudioSource(highDecelClip); } // flag that we have started the sounds playing m_StartedSound = true; } private void StopSound() { //Destroy all audio sources on this object: foreach (var source in GetComponents<AudioSource>()) { Destroy(source); } m_StartedSound = false; } // Update is called once per frame private void Update() { // get the distance to main camera float camDist = (Camera.main.transform.position - transform.position).sqrMagnitude; // stop sound if the object is beyond the maximum roll off distance if (m_StartedSound && camDist > maxRolloffDistance*maxRolloffDistance) { StopSound(); } // start the sound if not playing and it is nearer than the maximum distance if (!m_StartedSound && camDist < maxRolloffDistance*maxRolloffDistance) { StartSound(); } if (m_StartedSound) { // The pitch is interpolated between the min and max values, according to the car's revs. float pitch = ULerp(lowPitchMin, lowPitchMax, m_CarController.Revs); // clamp to minimum pitch (note, not clamped to max for high revs while burning out) pitch = Mathf.Min(lowPitchMax, pitch); if (engineSoundStyle == EngineAudioOptions.Simple) { // for 1 channel engine sound, it's oh so simple: m_HighAccel.pitch = pitch*pitchMultiplier*highPitchMultiplier; m_HighAccel.dopplerLevel = useDoppler ? dopplerLevel : 0; m_HighAccel.volume = 1; }
  • 53. 46 else { // for 4 channel engine sound, it's a little more complex: // adjust the pitches based on the multipliers m_LowAccel.pitch = pitch*pitchMultiplier; m_LowDecel.pitch = pitch*pitchMultiplier; m_HighAccel.pitch = pitch*highPitchMultiplier*pitchMultiplier; m_HighDecel.pitch = pitch*highPitchMultiplier*pitchMultiplier; // get values for fading the sounds based on the acceleration float accFade = Mathf.Abs(m_CarController.AccelInput); float decFade = 1 - accFade; // get the high fade value based on the cars revs float highFade = Mathf.InverseLerp(0.2f, 0.8f, m_CarController.Revs); float lowFade = 1 - highFade; // adjust the values to be more realistic highFade = 1 - ((1 - highFade)*(1 - highFade)); lowFade = 1 - ((1 - lowFade)*(1 - lowFade)); accFade = 1 - ((1 - accFade)*(1 - accFade)); decFade = 1 - ((1 - decFade)*(1 - decFade)); // adjust the source volumes based on the fade values m_LowAccel.volume = lowFade*accFade; m_LowDecel.volume = lowFade*decFade; m_HighAccel.volume = highFade*accFade; m_HighDecel.volume = highFade*decFade; // adjust the doppler levels m_HighAccel.dopplerLevel = useDoppler ? dopplerLevel : 0; m_LowAccel.dopplerLevel = useDoppler ? dopplerLevel : 0; m_HighDecel.dopplerLevel = useDoppler ? dopplerLevel : 0; m_LowDecel.dopplerLevel = useDoppler ? dopplerLevel : 0; } } } // sets up and adds new audio source to the gane object private AudioSource SetUpEngineAudioSource(AudioClip clip) { // create the new audio source component on the game object and set up its properties AudioSource source = gameObject.AddComponent<AudioSource>(); source.clip = clip; source.volume = 0; source.loop = true; // start the clip from a random point source.time = Random.Range(0f, clip.length); source.Play(); source.minDistance = 5; source.maxDistance = maxRolloffDistance;
  • 54. 47 source.dopplerLevel = 0; return source; } // unclamped versions of Lerp and Inverse Lerp, to allow value to exceed the from-to range private static float ULerp(float from, float to, float value) { return (1.0f - value)*from + value*to; } } } ENTER TO THE CAR using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityStandardAssets.Vehicles.Car; public class CarManager : MonoBehaviour { public Camera carCam; public CarUserControl userCtrl; private bool inVeh; private GameObject player; void Start () { userCtrl.enabled = false; carCam.enabled = false; inVeh = false; } void Update () { if (Input.GetKeyDown(KeyCode.E)) { if(inVeh == true) { vehicleControl(null); } } } public void vehicleControl(GameObject playerObj) { if(inVeh == false) { player = playerObj; carCam.enabled = true; userCtrl.enabled = true;
  • 55. 48 player.SetActive(false); player.transform.parent = this.transform; StartCoroutine(Time(true)); } else { player.SetActive(true); carCam.enabled = false; userCtrl.enabled = false; player.transform.parent = null; player = null; StartCoroutine(Time(false)); } } private IEnumerator Time(bool inVehicle) { yield return new WaitForSeconds(1); inVeh = inVehicle; } } DOOR TRIGGER using System.Collections; using System.Collections.Generic; using UnityEngine; public class DoorTrigger : MonoBehaviour { private bool inTrigger; private GameObject player; public CarManager carMan; void Update() { if(inTrigger == true) { if (Input.GetKeyDown(KeyCode.E)) { carMan.vehicleControl(player); inTrigger = false;
  • 56. 49 } } } void OnTriggerEnter (Collider col) { inTrigger = true; player = col.gameObject; } void OnTriggerExit() { inTrigger = false; player = null; } } ENEMY SCRIPTS using UnityEngine; public class chase : MonoBehaviour { public Transform player; public Transform head; static Animator anim; bool pursuing=false; // Use this for initialization void Start () { anim = GetComponent<Animator> (); } // Update is called once per frame void Update () { Vector3 direction = player.position - this.transform.position; direction.y = 0; float angle = Vector3.Angle (direction,this.transform.forward); if (Vector3.Distance (player.position, this.transform.position) < 60 && (angle < 360 || pursui ng) ) { pursuing = true; this.transform.rotation = Quaternion.Slerp (this.transform.rotation, Quaternion.LookRota tion (direction), 0.1f);
  • 57. 50 anim.SetBool("isIdle",false); if (direction.magnitude > 5) { this.transform.Translate (0, 0,0.05f); anim.SetBool ("isWalking", true); anim.SetBool ("isAttacking", false); } else { anim.SetBool ("isAttacking", true); anim.SetBool ("isWalking", false); } } else { anim.SetBool ("isIdle",true); anim.SetBool ("isWalking", false); anim.SetBool ("isAttacking", false); pursuing = false; } } } DESTROY var damage = 10; var damageTimer : float; var healthScript : Health; var player : GameObject; var UI_text : GameObject; var Deathcamera : GameObject; var restart_button : GameObject; function Start () { UI_text.SetActive (false); Deathcamera.SetActive (false); restart_button.SetActive (false); } function Update () { //Delete on Death if(healthScript.healthPoints <= 0) { Destroy(player); UI_text.SetActive (true);
  • 58. 51 Deathcamera.SetActive (true); restart_button.SetActive (true); } } function OnTriggerStay (other : Collider) { if (other.tag == "Player") { healthScript.healthPoints -= damage; } } AUDIO #pragma strict var winner :AudioClip; function Start () { } function Update () { } function OnTriggerEnter(){ GetComponent.<AudioSource>().PlayOneShot(winner); } ENEMY SPAWN using System.Collections; using System.Collections.Generic; using UnityEngine; public class EnemySpawn : MonoBehaviour { public GameObject enemy; public Transform enemyPos; private float repeatRate =5.0f; public // Use this for initialization void Start () { } void OnTriggerEnter(Collider other)
  • 59. 52 { if(other.gameObject.tag =="Player") { InvokeRepeating ("EnemySpawner", 0.5f, repeatRate); Destroy (gameObject, 11); gameObject.GetComponent<BoxCollider> ().enabled = false; } } void EnemySpawner() { Instantiate (enemy, enemyPos.position, enemyPos.rotation); } } MESSAGES #pragma strict private var guiShow : boolean =false; var riddle : Texture; function OnTriggerStay(Col:Collider) { if(Col.tag=="Car") { guiShow= true; } } function OnTriggerExit(Col:Collider) { if(Col.tag=="Car") { guiShow= false; } } function OnGUI() { if(guiShow==true) { GUI.DrawTexture(Rect(Screen.width/ 130,Screen.height/ 90,500,300),riddle); } } PAUSE MENU using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement;
  • 60. 53 public class PauseMenu : MonoBehaviour { public static bool GameIsPaused = false; public GameObject pauseMenuUI; // Update is called once per frame void Update () { if (Input.GetKeyDown (KeyCode.Escape)) { if (GameIsPaused) { Resume (); } else { Pause (); } } } public void Resume () { pauseMenuUI.SetActive (false); Time.timeScale = 1f; GameIsPaused = false; } void Pause () { pauseMenuUI.SetActive (true); Time.timeScale = 0f; GameIsPaused = true; } public void LoadMenu () { Time.timeScale = 1f; SceneManager.LoadScene ("Menu"); } public void QuitGame() { Application.Quit(); } }
  • 61. 54 RESTART using UnityEngine; using UnityEngine.UI; using System.Collections; public class restart : MonoBehaviour { public Button Text; public AudioClip sound; public string level; void Start () { Text = Text.GetComponent<Button> (); } public void Press() { Text.enabled = true; AudioSource.PlayClipAtPoint(sound, transform.position); Application.LoadLevel(level); } }
  • 62. 55 KEYPAD public string input; public bool onTrigger; public bool doorOpen; public bool keypadScreen; public Transform doorHinge; void OnTriggerEnter(Collider other) { onTrigger = true; } void OnTriggerExit(Collider other) { onTrigger = false; keypadScreen = false; input = ""; } void Update() { if(input == curPassword) { doorOpen = true; } if(doorOpen)
  • 63. 56 { var newRot = Quaternion.RotateTowards(doorHinge.rotation, Quaternion.Euler(0.0f, -90.0f, 0.0f), Time.deltaTime * 250); doorHinge.rotation = newRot; } } void OnGUI() { if(!doorOpen) { if(onTrigger) { GUI.Box(new Rect(0, 0, 200, 25), "Press 'T' to open keypad"); if(Input.GetKeyDown(KeyCode.T)) { keypadScreen = true; onTrigger = false; } } if(keypadScreen) { GUI.Box(new Rect(0, 0, 320, 455), ""); GUI.Box(new Rect(5, 5, 310, 25), input); if(GUI.Button(new Rect(5, 35, 100, 100), "1"))
  • 64. 27 Event Function: 'Fixed Update ()' The 'Fixed Update ()' function is called within each physics step; it will keep in sync with Unity's physics engine. The code within this function should also be as optimized as possible. Event Handler Function: ‘OnApplicationQuit ()' The 'OnApplicationQuit' function is actually defined as an Event Handler; all Event Handlers begin with 'On'. It is called on all game objects when the application is quit. In the editor it is called when the user stops play mode. In the web player it is called when the web view is closed.You can find more information about the Execution Order and the Update Order within the Unity Manual PHYSICS FUNCTIONS COLLIDERS Colliders are what physics engines use to perform hit detection. Unlike mesh objects, they know when they’ve come in contact with each other. They are simple shapes like boxes, spheres, or capsules that are assigned to your Game Objects and follow them around. You can think of them as something of a "force field". Conveniently, whenever a Game Object is created, it is automatically assigned an appropriate collider. A Cube gets a BoxCollider, a Sphere gets a SphereCollider, a Cylinder gets a CapsuleCollider, and so on RIGIDBODY A rigidbody is the the most critical element in a physics engine. Any GameObject it is attached to is included in the simulation. By default, a rigidbody is affected by gravity and air resistance, also known as drag. If we press Play, the block will start to fall, accelerate, and eventually hit terminal velocity when the force of gravity and drag equalize.
  • 65. 58 if(GUI.Button(new Rect(5, 245, 100, 100), "7")) { input = input + "7"; } if(GUI.Button(new Rect(110, 245, 100, 100), "8")) { input = input + "8"; } if(GUI.Button(new Rect(215, 245, 100, 100), "9")) { input = input + "9"; } if(GUI.Button(new Rect(110, 350, 100, 100), "0")) { input = input + "0"; } } } } } MOVING SCENE using System.Collections; using System.Collections.Generic;
  • 66. 59 using UnityEngine; using UnityEngine.SceneManagement; public class MoveScene : MonoBehaviour { [SerializeField] private string loadLevel; void OnTriggerEnter(Collider other) { if(other.CompareTag("Player")) { SceneManager.LoadScene (loadLevel); } } } SPLASH SCREEN using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; public class SplashFade : MonoBehaviour { public Image splashImage; public string loadLevel; IEnumerator Start()
  • 67. 60 { splashImage.canvasRenderer.SetAlpha (0.0f); FadeIn (); yield return new WaitForSeconds (2.5f); FadeOut (); yield return new WaitForSeconds (2.5f); SceneManager.LoadScene (loadLevel); } void FadeIn() { splashImage.CrossFadeAlpha (1.0f, 1.5f, false); } void FadeOut() { splashImage.CrossFadeAlpha (0.0f, 2.5f, false); } } MAIN MENU using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class MainMenu : MonoBehaviour { // Use this for initialization public void PLayerGame () {
  • 68. 61 SceneManager.LoadScene (SceneManager.GetActiveScene ().buildIndex + 1); } public void QuitGame() { Debug.Log ("QUIT"); Application.Quit (); } } DESTROY GAME OBJECT PLAYING A SOUND #pragma strict var CoinSound:AudioClip; function OnTriggerEnter(other:Collider) { if(other.tag=="Player") { GetComponent.<AudioSource>().PlayOneShot(CoinSound); yield WaitForSeconds(0.4); Destroy(gameObject); } } ENHANCE THE SPEED OF GAME using System.Collections; using System.Collections.Generic; using UnityEngine; public class speed : MonoBehaviour { // Use this for initialization void Start () { }
  • 69. 62 // Update is called once per frame void Update () { Time.timeScale = 1.5f; } } DISPLAY THE SCORE using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class ScoreTextScript : MonoBehaviour { Text text; public static int coinAmount; // Use this for initialization void Start () { text = GetComponent<Text> (); } // Update is called once per frame void Update () { text.text = coinAmount.ToString (); } }
  • 71. 64
  • 72. 65
  • 74. 67 7.CONCLUSION Working with the game engine completely anew experience for us. Normally we are working with different object-oriented languages, DBMS, mark up languages etc. I adopted these things through video tutorials, text tutorials internet and learning materials given by the tools themselves. It’s a matter of time, patience, and hard work. It is very sensible work it demands much time because the game engines try to connect the game environment with the real world. creating a 3d model is very difficult because I need to work each and every point in that model. MY ACHIEVEMENTS • Develop communication skill • Understand what an SRS document is how it is helpful to my project • So much knowledge about modelling and animation • Growing creative thinking • Rapidly improve imagination capability • Time management • Improve typing skill • More deeply understand the scripting languages • Control my frustration • I spend a whole day in front of a pc to do my project without sleep without food as proper diet my only one aim is to complete this project in any way I strongly believe that I surely achieve this task. I’m never ready to give up. • Understand how much effort needed to achieve my goal
  • 75. 68 8.FUTURE ENHANCEMENT The present project has been developed to meet the aspirations indicated in the modern age. An attempt has been made through this project to do all work ease and the fast .my project will implement in future after making some changes and modifications as we make our project at a very low level .so the modifications that can be done in our project are: IT can be made with good graphics.
  • 76. 69 9.BIBLIOGRAPHY BOOK REFERED • Learning C# Programming with Unity 3D Book by Alex Okita WEBSITE REFERED • https://unity3d.com/ • https://www.lynda.com/Unity-training-tutorials/1242-0.html • http://www.learncs.org/ • https://www.youtube.com/user/Brackeys • https://www.youtube.com/channel/UCRMXHQ2rJ9_0CHS7mhL7erg • https://www.udemy.com/unitycourse/