Ethoreal Shift

Swarna Kundu
ID: 142-40-128

Fahim Ahmed
ID: 142-40-138

This Report Presented in Partial Fulfillment of the Requirements for the Degree of Bachelor of Science in Multimedia and Creative Technology

Supervised By

Dr. Shaikh Muhammad Allayear
Associate Professor and Head
Department of MCT
Daffodil International University

16 APRIL, 2018


This Project titled “Ethoreal Shift”, submitted by Swarna Kundu & Fahim Ahmed to the Department of Multimedia and Creative Technology, Daffodil International University, has been accepted as satisfactory for the partial fulfillment of the requirements for the degree of B.Sc. in Multimedia and Creative Technology and approved as to its style and contents. The presentation has been held on 16 April, 2018.


(Name) Chairman
Department of MCT
Faculty of Science & Information Technology
Daffodil International University

(Name) Internal Examiner
Department of MCT
Faculty of Science & Information Technology
Daffodil International University

(Name) External Examiner
Department of ——-
Jahangirnagar University


We hereby declare that, this project has been done by us under the supervision of Dr. Shaikh Muhammad Allayear, Associate Professor and Head, Department of MCT, Daffodil International University. We also declare that neither this project nor any part of this project has been submitted elsewhere for award of any degree or diploma.

Supervised by:

Dr. Shaikh Muhammad Allayear
Associate Professor and Head
Department of MCT
Daffodil International University

Submitted by:

Swarna Kundu
ID: 142-40-128
Department of MCT
Daffodil International University

Fahim Ahmed
ID: 142-40-138
Department of MCT
Daffodil International University


First, we express our heartiest thanks and gratefulness to almighty God for His divine blessing makes us possible to complete the final year project successfully.

We are really grateful and wish our profound our indebtedness to our supervisor, Dr. Shaikh Muhammad Allayear, Associate Professor and Head, Department of MCT Daffodil International University, Dhaka. Deep Knowledge & keen interest of our supervisor in the field of “Game Design & Development to carry out this project. His endless patience, scholarly guidance, continual encouragement, constant and energetic supervision, constructive criticism, valuable advice, reading many inferior draft and correcting them at all stage have made it possible to complete this project.

We would like to express our heartiest gratitude to Mr. Mirza Mohtashim Alam, Lecturer, Department of MCT, for his kind help to finish our project and to other faculty member and the staff of MCT department of Daffodil International University.

We would like to thank our entire course mate in Daffodil International University, who took part in this discuss while completing the course work.

Finally, we must acknowledge with due respect the constant support and patients of our parents.


For this project, we wanted to design a computer game in Unity. So we decided to design a Role-Playing game (RPG) where the objective is to collect three elemental stones, save the planet using the stones and get out of the game by finishing it. The player, who is a magician, has to collect three stones by defeating enemies in different levels and save the planet from being destroyed. The game is designed & developed in Microsoft Windows and written in C# using Unity Game Engine, Monodevelop and Microsoft Visual Studio. We have implemented many advanced programming functions in this project as taught in our Multimedia Authoring & Game Development course. As a result, we have created a 3D RPG game that we hope would be fun to play and enjoyable.

Board of examiners i
Declaration ii
Acknowledgements iii
Abstract iv
CHAPTER 1: Introduction
1.1 Gaming in Our Field 1
1.2 Background of this Project 1


Figure 1: Screen capture of Unity 4
Figure 2.1.1: numbering according to sub sections 11

CHAPTER 1: Introduction

This chapter covers our project proposal and achievability of the planning along with background research, the possibilities and few initial concepts of our game.

1.1 Gaming in Our Field
In the rapidly growing sector of game design, the future has become hard to predict. We are developing this game as for our Final Project Phase-II. Phase-II is a 3-credit course and as part of our degree, we chose this type of project for doing better with graphics, scripting, 3-D modeling, texturing, animation & game design. In a game project, we have the opportunity to implement everything we learned in these four years from graphics design, story & script writing, storyboarding, 3-D modeling, animation, texturing, lighting and many other things in the environment of the game, the story, characters, game play, the artworks and so on.

1.2 Background of this Project
Our game is a single player first person Role Playing game (RPG) emphasizing on storytelling, action and adventures. These often focus on resources and time management, which usually prioritizes over character involvement and fast action. Strategic organization and implementation are necessary, and the game developers usually put the versatility of decision-making and execution of commands in the gamer’s hands.

1.3 About the Project
It is a first person Role Playing game (RPG) with different levels to play. The main character of ‘Ethoreal Shift’ is a boy who gets teleported into the game he was playing and becomes the avatar of the main character of the game who is a magician. He cannot return to his own world unless he finishes the game. The main mission of the gamer is to use his powers to save the world. There are several levels and in each level, the gamer must complete the quests or objectives and collect the stones that he needs to use at the last level.

1.4 Scope of Our Game
This document discusses all necessary requirements of this project in details. The basis of this groundwork is to provide an implicit image with both structured and unstructured information of our project “Ethoreal Shift”. This game is a first person Role Playing game (RPG) developed on and for Microsoft Windows platform. The player will advance through levels, which require precise and strategic manipulation of the player’s creative and logical thinking. The episodic structure of the game simplifies the momentum of the game’s story. We exhibit the strategic implementation of script, inputs and display (output) as we are focusing mainly on concept of the story, game levels, objects in the game, character animation, graphics, scripts and game engine features.

1.5 Project Scheduling
Start Date End Date Project States and Objectives
January 5 January 25 Project Proposal, meeting with supervisor about our idea
January 26 February 10 Planning, elaborating game story, levels planning and completing necessary preparations
February 16 February 28 Choose tools, environment, finished 3-D modeling and texturing of game objects
March 1 March 20 Start level designing and model implementation, rethinking game plot
March 21 April 8 Start programming, developing game logic, testing and enhancement
April 9 April 14 Project report writing and conducting tests on the constructed levels
April 16 Displaying project progress at our Predefense
April 17 April 26 Final revision of the report and perform fine-tuning on the game logics and bugs
April 28 May 12 Conducting final tests on the game, fixing bugs and compile executable files
Not Announced Yet Project final showcase and submission

We have re-scheduled the planning of this project based on the predefense schedule, which now leads us to the specification part of the project, but may change later depending on the final defense schedule.

Chapter 2: Software Requirements Specification of “Ethoreal Shift”

This chapter covers the initial requirements specification of our game “Ethoreal Shift”. It incorporates the definition of this report with basic descriptions, specified requirements, and evaluation of models. It also contains modification management of this requirement specification in case of any modification is done.

2.1 Introduction
In this section, the specification of this documentation is described. It describes the rules of the document, document purview and also presents a suggestion for the readers of the document.

2.1.1 Purpose of this Chapter
This Software Requirements Specification (SRS) part is meant to provide a comprehensive overview of our Project “Ethoreal Shift” incorporating the action flow, the story and game user interface. The SRS document describes all aspects of the project that shows the references, manners and relevance of their execution.

2.1.2 Intended Audience and Reading Suggestions
The SRS document provides us a method to establish the game’s commitment to our original vision. For a summery of the report and the project, please refer to Overall Description. For a detailed documentation of the game-play elements and their interaction with the player, refer to System Features. Readers curious about the game-play user interface and navigation between the front-end options should read External Interface Requirements. Specialized guidelines to which the developer team will work on the project are described in details in Other Nonfunctional Requirements. The design and development timeline will be preserved in the Key Milestones.

2.1.3 Scope of this Document
This Software Requirements Specification (SRS) explains the functional and nonfunctional prerequisites for the project. The intension of this section is to deliver a close enough image for both structured and unstructured information of this game project. The concept of “Ethoreal Shift” was perceived by both of the members of our team, as having a predicted development time lengthy than the duration of this semester. Our team Desires to work on the project until it’s complete. We will continue to develop the game until we find it more than competent for open-source distribution.

2.2 General Description
This segment contains the viewpoint of our project and the structural framework it demands. It defines the QFD (Quality Function Deployment) of this game and also the story of it.

2.2.1 Product and Business Perspective of the Game
Design and development of a game like this from scratch is an outstanding challenge for any game studio. It demands substantial amount of investments in terms of cost and effort and also requires the client’s participation, knowledge and understanding about the expected marketplace (example: Steam, Origin). This report describes overall product perspective.

2.2.2 System Environment

Player can interact and communicate with the system by giving input to the system. System commands those inputs to the related script, if any change happens like the value of certain variable is changed, the script sends required instructions to render the objects to display (Player changing his position).

2.2.3 Quality Function Deployment of “Ethoreal Shift”
Quality Function Deployment is a procedure that expresses the requirements of the client into structured requirements for software or game. It focuses on maximizing client satisfaction throughout the game development process. The following requirements concerning our project have been identified by a QFD.
? General Requirements.
? Expected Requirements.

General Requirements
General requirements include goals and objectives which have been specified in the meeting with the relevant peoples concerning the project. general requirements of our project are: –
1. Efficient, user friendly and productive system.
2. Least amount of effort in development and future support.
3. Achievability of desired requirements within targeted PC configuration.
4. Easy to play.
5. Developed with professional approach.
6. Well structured coding, creative and professional thinking.

Expected Requirements
These requirements are inherent to the system and can be so rudimentary that the
gamer and relevant people does not specify them comprehensively. Unable to implement them might become a cause of disappointment.
1. Develop the whole game as planned in the scheduled time.
2. Minimum hardware prerequisites, which is suitable for the game.
3. Design and develop the whole game in a well-organized style.

2.2.4 User Story
As we have specified above, “Ethoreal Shift” is a first person Role Playing game (RPG). We desire to develop it as a cross-platform game which would be supported by PC, console, android phone, IOS and also other available platforms. But as we have very limited time to complete the game, it has only been developed for PC (Microsoft Windows). So the gamer can use any windows pc to run the game. After running the game, the UX view of the game will appear on the screen. UX means User Experience, which refers to all aspects of an individual’s experience of interacting with a system. Then the gamer can select “Start Game” from the “Main Menu” and start playing the game. After starting the game, a cut scene would be shown to the player to give him an idea about the story. When the cut scene ends, player will be given a briefing about the backstory and his primary mission on the screen. He may also interact with “Pause Menu” by pressing “Escape”. If he loses he can replay the level as the level will automatically restart after the player’s death. Or he can exit game by pressing “Quit” in the “Pause Menu”.
The story behind the game is about a boy who gets teleported into a game he was playing in his pc. He becomes the avatar of the main character of the game, a magician who is the descendent of another great magician who saved the world from destruction long time ago. The objective of the gamer is to collect three elemental stones by completing three different quests, which he will use at the last level to save the planet from being destroyed by the rays of Super Red Moon. As mentioned earlier, the gamer will find tips in different steps which will help him to go to the finishing stage. In first level, the player has to search for information about his mission in Sylvista village. He finds a merchant of magic items in the village. The merchant tells him to find scrolls which are spread around the village. There is an Inventory System that stores everything the player collects. After collecting all the scrolls in the village, the player has to use those scrolls to teleport to Daryas city.
In that city, player needs to find more scrolls hidden around the city to find the location of the stones. Then he goes to the jungle to collect the Dryad stone. The player has to defeat every wood cutter in the forest to get the stone. The player uses fire to defeat his enemies. He has two attacks, first one is fireball that player throws at his enemies. Second one is a charged attack, a burst of flame, where he keeps throwing flames at his enemies. But he can use that charged attack after an interval as he needs to regain his magical energy. Then, he returns to the city with the stone. He has to go to Sylvista village again, to the merchant in order to obtain a magic artifact that will allow him to use explosion spell. Then he goes to the machine site with the artifact to get the Zephyrus stone, where a machine is polluting the air. The area is guarded by Paladin knights equipped with sword and shield. The player has to defeat every knight in the area and cast an explosion spell at the building that is producing smoke using the machine.
After collecting the Zephyrus stone, he goes to his last quest to get the last stone, Darya. Last level is a factory site with a forest at the front and is guarded by both woodcutters and Paladin knights. After defeating all the enemies, the player casts the explosion spell on the factory and the Darya stone appears before him. After collecting all 3 stones, he goes to a cave, a sacred waterfall where he can use the power of the stones to save the world. He puts the three stones on a magic table with ancient glyphs, the table unleashes the power of the stones creating a barrier around the planet to protect it from the Super Blood Moon and the player is teleported back to his own world in his room.

2.3 Specific Requirements
This segment discusses the project external requirements of the game and also signifies the user attributes for this project.

2.3.1 External Interface Requirements of the Game User Interfaces
Every game must have a main menu, so the gamers can easily start the game. The menu is an important element for creating the SRS document. In this SRS document section, we have used snapshots of the menu in the user manual subsection. Those snapshots are established on the menu of this game. Hardware Interfaces
“Ethoreal Shift” is a pc game designed specifically for the Microsoft Windows and can be played on all mid to high-end desktops and laptops. Game data is stored locally on the game engine elements. Windows is graphically and universally adaptable with both 2D and 3D graphics library based on OpenGL ES 2.0, 3.0 and different DirectX specifications as well as hardware configuration, pixel format conversion, accelerated 3D graphics and scaling. Software Interface
“Ethoreal Shift” has been designed and developed using a series of 3D modelling, game design and development software.

Software and tools used in this project:
? Unity3D 5.6 and 2018.1 (Game Engine)
? Autodesk Maya 2016 (3D modeling and animation)
? Adobe Fuse CC Beta (Character Generation)
? Adobe Photoshop CC 2014 (Creating Texture)
? Substance Painter 2 (Model Texturing)
? Substance Bitmap2Material (Image to Material Map Conversion)
? Microsoft Visual Studio 2017 Community Edition (Programming)
? Microsoft Visual Studio Code (Programming)
? Adobe After Effects (Editing Cut scene)

2.3.2 User Characteristics for the Game
The game can be played by only one player at a time and the user can interact with the game in different ways. The player is the one who can communicate with the system by playing the game. And the player can be any individual. The initial requirement is, that the player should read the playing mechanism provided by the developers (us).

2.4 Requirement Change Management of Our System
We hope to deliver a complete and fully working game that works according to the guidelines stated in the SRS document. But, as the game will be released for multiple Windows versions (i.e. the different desktops and laptops running different Windows version), updates will likely be necessary to address issues like fixing bugs that made into final version of the game, compatibility patches and expansions of the content. If the gamers experience any issues, bugs or want to give feedback, they can communicate with the developers through our official support email address which will be specified later. For managing the changes, we are releasing versions of this document. This one is version 1.1.

2.5.1 Bugs and Glitches
The players would be able to communicate with us, the developers through the support email. This is where they would notify us of any bugs or glitches they have detected and if they have any feeling that the game is not working properly. Issues of gamers or comments would also be submitted by support email. We will monitor this email continuously in order to answer all questions and fix any problems that have surfaced.

2.5.2 Patches
As the recent Windows 10 is frequently updated and the vast amount of combination of pc configuration exists, the game would also need to be updated frequently. We would constantly be making changes in order to fix any compatibility issues that may arise. These modifications, bug or glitches fixes will be updated by these patches.

Chapter 3: Design and Implementation of “Ethoreal Shift”

This chapter discusses about the design phases of this project, the system characteristics and also the implementation of system features.

3.1 Game Design

For this game, we had to design lots of characters for the Player, enemies and town-folks. We also design several levels and environments where the game’s story will take place.

3.1.1 Characters The Player

In first person view, this capsule works as the player
body. Since the player won’t be visible, using this capsule as player helps to take some load off the computer. Enemies

This is the wood cutter, first enemy in the game. They
are seen in every level working or talking, but the
player only fights with them in Quest 1 and 3. They
stays in idle when player is not around. But they keep
moving toward the player when the player is in range
and when they get close to the player, they start
attacking with the axe.

This is the Paladin Knight, second enemy in the game
and more powerful than the woodcutter. They are also
seen in every level talking or guarding the Citadel gate,
but player only fights with them in Quest 2 and 3. As
they have armor and shield, they have more health than
the woodcutter. Local Peoples

These are local peoples who are either talking to others or walking around. They are created to liven up the environment.

Archer and adventurer who is seen talking with other peoples or walking around in Sylvista and Daryas city.

Another archer and adventurer who is seen talking with other peoples or walking around in Sylvista and Daryas city.

Local girl of Asian ancestry seen walking around or talking with other peoples in Sylvista and Daryas city.

Local women and also a merchant who is seen talking with other peoples, walking around or running magic shop in Sylvista and Daryas city.

Guardian knight of the great king who is seen talking with other peoples or walking around in Sylvista and Daryas city. (We wanted to use him as an enemy, but he seemed more like a noble knight. So we kept him as a local)

Just an old man, seen talking with other peoples or walking around in Sylvista and Daryas city. Items

Magic health potion to heal the player when injured.

Magic scroll that the player collects in Sylvista and Daryas city. Elemental Stones

The Dryad stone representing forest goddess in greek mythology. It is given to player in Quest 1 after the player defeats every woodcutter in the forest.

The Zephyrus stone representing the god of west wind in greek mythology. It is given to player in Quest 2 when he defeats all paladin knights and destroys the machine room.

The Darya stone representing water in greek. It is given to the player in Quest 3 when he defeats all wood cutters and paladin knights and destroys the building polluting the water.

3.2 Level and Environment Design

3.3 Project Design Terms
For every project, two primery terms of design are very important. They are:
• User Experience (UX)
• Backend Programming

3.3.1 User Experience (UX)
In order to avoid needless features, make the design report simple and to make the gamer’s interaction with the game easy and efficient, UX design is must. User experience design (UXD or UED) is any impression of an individual’s experience with a specified system, along with the interface, design, graphics and manual interaction. User Experience Design completely incorporates conventional Human-Computer Interaction (HCI) concepts and design, and spreads it through evaluating all attributes of a product or service as comprehended by users. UX represents primarily suitable approach to feasibility, functionality and HCI. UX describes user experience as “an individual’s perceptions and acknowledges that outcome from the use or predicted use of a system, product or service”.

3.3.2 Backend Programming
The “back end” is the code or script sustaining that front end. In short, front end of a software or game is what we see (i.e. the user interface) and back end is the engine that we do not see. For effective execution and to expand user acceptance, both of them are very important in game industry.
3.4 System Features of Our Game
? Title Screen
? Main Menu
? Pause Menu
? Health Meter
? Magical Power Meter
? Attack Interval Timer
? Inventory System
? Easy Control
? Immersive Action
? Quests
? Dialogue System
? Exit Point

3.4.1 Title Screen Description and Priority
The title screen is the screen the player will see every time upon starting the game. Through this interface, the player can choose to start the game or exit the game. Since the title screen is the “hub” for all activities in the project, it must be included. Response Sequences
Step 1: The player launches the game from their device.
Step 2: The start screen loads and appears, prompting the player with two buttons: “Play Game” and “Exit”.
Step 3: The player presses one of the buttons, triggering its respective function. Functional Requirements
REQ-1: The title screen must load and appear every time the game is launched.
REQ-2: If the player quits the game during any stage of a level, they must be returned to the title screen.
REQ-3: If the player presses the exit button, the game will end and return the player to the computer’s regular interface.
REQ-4: If the player completes the game, the game will end and return the player to the title screen.

3.4.2 Pause Menu Description and Priority
The player should be able to pause anytime during gameplay, and this screen fulfills that requirement. The pause menu also allows the player to navigate between gameplay and title screens. Player can also change level of music and sound effects in this menu. Response Sequences
Step 1: The player presses the Escape button on the keyboard.
Step 2: The level pauses, drawing up the pause menu which prompts the player with two options: “Resume Game” and “Exit Game.”
Step 3: The player presses one of the buttons, triggering its respective function. Functional Requirements
REQ-1: The “Resume Game” option must continue the game without any change to the character’s vector or the state of the level from the moment of the pause action.
REQ-2: The “Quit Game” option must close the game and return to the desktop screen.

3.4.3 Dialogue Descriptions and Priority
Dialogue is a method by which the player will be briefed about his next missions and objectives. The player is guided to his next objectives using dialogue with the silent protagonist, providing context and narrative. While this feature is secondary in importance to the primary game mechanics, it is an important aspect of the game’s atmosphere and it helps to heighten the player’s connection to the experience. Response Sequences
Step 1: The player goes to the Merchants office and presses the specified button.
Step 2: Dialogue is triggered and a text box pops up.
Step 3: To dismiss text boxes or continue reading multiple-page text boxes, the player clicks on Continue button. Functional Requirements
REQ-1: Dialogue should not pause the game to prevent player disorientation.
REQ-2: Text boxes should be brief and placed away from UI components so as not to interfere with game-play.
REQ-3: The text must be readable from any screen.

3.4.4 Exit Point Descriptions and Priority
Exit point is the finishing place of the levels. The player needs to complete the objectives and mission given to him to proceed to the next level or quest. Response Sequences
Step 1: The player completes the objectives or mission.
Step 2: Player goes to the exit point.
Step 3: The Player is teleported to the next level. Functional Requirements
REQ-1: Objectives must be completed to finish the level.
REQ-2: Exit point must be in reach of the player.

3.5 Assumptions and Dependencies
The target platform of our game project will be the Microsoft Windows devices. However, Unity will be responsible for both the construction of the game and its integration within the Windows framework.

3.5.1 Construction of the Game
Unity includes many built-in components which will expedite the process of game development immensely. These include:
? Physics Engine
? Collision Detection and Handling
? Input Recognition
? Object Creation and Transform Manipulation (position and rotation of game objects)
? Scene Integration (transition of one level to the next)
? Model Attachment (representing game objects with 3D models from external programs)

3.5.2 Integration with Windows
Unity’s build settings simplify the process of compiling our game for the Windows platform. After completing the project, or during any intermediary step for testing, we can select Windows from the list of options, build the project, and play it on the same pc.

3.6 Key Resource Requirements of the Project
Major Project
activities Skill/Expertise
Required Works by Teammates External
Resources Issues/Constraints
Level Design Ability to translate aspects of the story into playable levels Both members made the decision about game levels together Ideas from
existing games
(Ex. Miami Adventures) No Issues
Physics Engine Knowledge of functions available
in Unity and the
ability to change
them as needed Both members worked on Unity game engine Unity game
engine Ability to angle
interactive portions of levels
3D Modeling Knowledge of
3D modeling software Both members created necessary 3D models 3D model design
using Autodesk Maya Difficulties in UV mapping because of complex 3D models
Texturing of 3D Models Knowledge of texturing software We both did the texturing of 3D models Adobe Photoshop
Substance Painter
Substance Bitmap2Material Frequent software crash because of low-end computers
Implementation Ability to incorporate sound clips smoothly into the game – Sound clips from
the Internet –

Implementation Familiarity with
scripting language of game engine Both members have some
knowledge about scripting
language Scripts from our previous games Level size dependent on hardware configuration
Documentation Knowledge about Formal
Report Writing Both members worked on the Report Idea from
Existing Reports
(Ex. University Report Guideline) Game Reports are
different from
conventional ones

3.7 Implementation Tools Required
Software Name Developer Company Usage Work Area
Unity3D 5.6
& 2018.1 Unity Technologies Game Engine Game Design
Autodesk Maya 2016 Autodesk 3D Modeling and Animation Creating 3D models and game objects
Adobe Fuse CC Adobe Incorporated Character Generation Creating characters for the game
Adobe Photoshop CC 2014 Image Editing Creating textures for 3D models
Adobe After Effects CC 2014 Creating & Editing Videos Editing and applying necessary effects to cut scenes
Substance Painter 2 Substance Texturing & Shading Texturing of the 3D models
Substance Bitmap2Material Bitmap to Material Conversion Converting images to textures for 3D models
Microsoft Visual Studio 2017 Community Edition Microsoft Programming Coding scripts for the game
Microsoft Visual Studio Code

3.8 Implemented Codes & Scripts
We have used C# as our programming language for the game, as it is easy to create, modify and implement. Unlike other games, we haven’t implemented any scoring system as score doesn’t have any parts in our game. We heavily emphasized on item collection and mission objectives.
Here are the codes we wrote for our game:
First Person Controller:
using System;
using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;
using UnityStandardAssets.Utility;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using Random = UnityEngine.Random;

public class FirstPersonController : MonoBehaviour
SerializeField private bool m_IsWalking;
SerializeField private float m_WalkSpeed;
SerializeField private float m_RunSpeed;
SerializeField Range(0f, 1f) private float m_RunstepLenghten;
SerializeField private float m_JumpSpeed;
SerializeField private float m_StickToGroundForce;
SerializeField private float m_GravityMultiplier;
SerializeField private MouseLook m_MouseLook;
SerializeField private bool m_UseFovKick;
SerializeField private FOVKick m_FovKick = new FOVKick();
SerializeField private bool m_UseHeadBob;
SerializeField private CurveControlledBob m_HeadBob = new CurveControlledBob();
SerializeField private LerpControlledBob m_JumpBob = new LerpControlledBob();
SerializeField private float m_StepInterval;
SerializeField private AudioClip m_FootstepSounds; // an array of footstep sounds that will be randomly selected from.
SerializeField private AudioClip m_JumpSound; // the sound played when character leaves the ground.
SerializeField private AudioClip m_LandSound; // the sound played when character touches back on ground.
public float pHealth;
public float maxHealth = 100f;
public Transform startPoint;
public Item item;
public Text scrolls;
public GameObject pDeathText;
public static int scrollCount;
public static float enemyCount;
public AudioClip scrollCollect;
public Image healthBar;
private Camera m_Camera;
private bool m_Jump;
private float m_YRotation;
private Vector2 m_Input;
private Vector3 m_MoveDir =;
private CharacterController m_CharacterController;
private CollisionFlags m_CollisionFlags;
private bool m_PreviouslyGrounded;
private Vector3 m_OriginalCameraPosition;
private float m_StepCycle;
private float m_NextStep;
private bool m_Jumping;
private AudioSource m_AudioSource;

private void Start()
m_CharacterController = GetComponent();
m_Camera = Camera.main;
m_OriginalCameraPosition = m_Camera.transform.localPosition;
m_HeadBob.Setup(m_Camera, m_StepInterval);
m_StepCycle = 0f;
m_NextStep = m_StepCycle / 2f;
m_Jumping = false;
m_AudioSource = GetComponent();
m_MouseLook.Init(transform, m_Camera.transform);
pHealth = 100f;
scrollCount = 0;
enemyCount = 0;
scrolls.text = scrollCount.ToString();
m_CharacterController.transform.position = startPoint.position; //Moves the Player to the assigned Start Point.

private void Update()
// the jump state needs to read here to make sure it is not missed
if (!m_Jump)
m_Jump = CrossPlatformInputManager.GetButtonDown(“Jump”);
if (!m_PreviouslyGrounded && m_CharacterController.isGrounded)
m_MoveDir.y = 0f;
m_Jumping = false;
if (!m_CharacterController.isGrounded && !m_Jumping && m_PreviouslyGrounded)
m_MoveDir.y = 0f;
m_PreviouslyGrounded = m_CharacterController.isGrounded;
if (startPoint == null)
startPoint = transform; //If Start Point is not assigned, player transform will be used.
if (pHealth 0 && (m_Input.x != 0 ||
m_Input.y != 0))
m_StepCycle += (m_CharacterController.velocity.magnitude + (speed *
(m_IsWalking ? 1f : m_RunstepLenghten))) *
if (!(m_StepCycle > m_NextStep))
m_NextStep = m_StepCycle + m_StepInterval;
private void PlayFootStepAudio()
if (!m_CharacterController.isGrounded)
// pick & play a random footstep sound from the array,
// excluding sound at index 0
int n = Random.Range(1, m_FootstepSounds.Length);
m_AudioSource.clip = m_FootstepSoundsn;
// move picked sound to index 0 so it’s not picked next time
m_FootstepSoundsn = m_FootstepSounds0;
m_FootstepSounds0 = m_AudioSource.clip;
private void UpdateCameraPosition(float speed)
Vector3 newCameraPosition;
if (!m_UseHeadBob)
if (m_CharacterController.velocity.magnitude > 0 &&
m_Camera.transform.localPosition =
m_HeadBob.DoHeadBob(m_CharacterController.velocity.magnitude +
(speed * (m_IsWalking ? 1f : m_RunstepLenghten)));
newCameraPosition = m_Camera.transform.localPosition;
newCameraPosition.y = m_Camera.transform.localPosition.y –
newCameraPosition = m_Camera.transform.localPosition;
newCameraPosition.y = m_OriginalCameraPosition.y – m_JumpBob.Offset();
m_Camera.transform.localPosition = newCameraPosition;
private void GetInput(out float speed)
// Read input
float horizontal = CrossPlatformInputManager.GetAxis(“Horizontal”);
float vertical = CrossPlatformInputManager.GetAxis(“Vertical”);
bool waswalking = m_IsWalking;

// On standalone builds, walk/run speed is modified by a key press.
// keep track of whether or not the character is walking or running
m_IsWalking = !Input.GetKey(KeyCode.LeftShift);
// set the desired speed to be walking or running
speed = m_IsWalking ? m_WalkSpeed : m_RunSpeed;
m_Input = new Vector2(horizontal, vertical);

// normalize input if it exceeds 1 in combined length:
if (m_Input.sqrMagnitude > 1)

// handle speed change to give an fov kick
// only if the player is going to a run, is running and the fovkick is to be used
if (m_IsWalking != waswalking && m_UseFovKick &&
m_CharacterController.velocity.sqrMagnitude > 0)
StartCoroutine(!m_IsWalking ? m_FovKick.FOVKickUp() :
private void RotateView()
m_MouseLook.LookRotation(transform, m_Camera.transform);

public void TakeDamage(float dAmount)
pHealth -= dAmount;
healthBar.fillAmount = pHealth / 100f;
if (pHealth = pAttackInterval && Time.timeScale
!= 0)

//Charged Attack.
if (Input.GetButtonDown(“Fire2”) && cTimer >= cAttackInterval && Time.timeScale != 0)


//Primary Attack parameters
void PrimaryAttack()
pTimer = 0f; //Resets Primary Attack timer.
pAttack.Simulate(1); //Starts the effect.
pAttack.Play(); //Plays the effect.
RaycastHit hit; //Reference to Raycast hit point.
if (Physics.Raycast(cam.transform.position, cam.transform.forward, out hit, range))
target = hit.transform.GetComponent();
if (target != null)
target.TakeDamage(pDamage); //Enemy takes damage.

//Chrged Attack parameters
void ChargedAttack()
cTimer = 0f; //Resets Charged Attack timer.
cAttack.Simulate(1); //Starts the effect.
cAttack.Play(); //Plays the effect.
RaycastHit hit; //Reference to Raycast hit point.
if (Physics.Raycast(cam.transform.position, cam.transform.forward, out hit, range))
target = hit.transform.GetComponent();
if (target != null)
target.TakeDamage(cDamage); //Enemy takes damage.

Mouse Look:

using System;
using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;

public class MouseLook
public float XSensitivity = 2f;
public float YSensitivity = 2f;
public bool clampVerticalRotation = true;
public float MinimumX = -90F;
public float MaximumX = 90F;
public bool smooth;
public float smoothTime = 5f;
public bool lockCursor = true;
private Quaternion m_CharacterTargetRot;
private Quaternion m_CameraTargetRot;
private bool m_cursorIsLocked = true;

public void Init(Transform character, Transform camera)
m_CharacterTargetRot = character.localRotation;
m_CameraTargetRot = camera.localRotation;

public void LookRotation(Transform character, Transform camera)
float yRot = CrossPlatformInputManager.GetAxis(“Mouse X”) * XSensitivity;
float xRot = CrossPlatformInputManager.GetAxis(“Mouse Y”) * YSensitivity;

m_CharacterTargetRot *= Quaternion.Euler (0f, yRot, 0f);
m_CameraTargetRot *= Quaternion.Euler (-xRot, 0f, 0f);

m_CameraTargetRot = ClampRotationAroundXAxis

character.localRotation = Quaternion.Slerp (character.localRotation,
smoothTime * Time.deltaTime);
camera.localRotation = Quaternion.Slerp (camera.localRotation,
smoothTime * Time.deltaTime);
character.localRotation = m_CharacterTargetRot;
camera.localRotation = m_CameraTargetRot;
public void SetCursorLock(bool value)
lockCursor = value;
{//we force unlock the cursor if the user disable the cursor locking helper
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
public void UpdateCursorLock()
//if the user set “lockCursor” we check & properly lock the cursos
if (lockCursor)

private void InternalLockUpdate()
m_cursorIsLocked = false;
else if(Input.GetMouseButtonUp(0))
m_cursorIsLocked = true;

if (m_cursorIsLocked)
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
else if (!m_cursorIsLocked)
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;

Quaternion ClampRotationAroundXAxis(Quaternion q)
q.x /= q.w;
q.y /= q.w;
q.z /= q.w;
q.w = 1.0f;
float angleX = 2.0f * Mathf.Rad2Deg * Mathf.Atan (q.x);
angleX = Mathf.Clamp (angleX, MinimumX, MaximumX);
q.x = Mathf.Tan (0.5f * Mathf.Deg2Rad * angleX);
return q;

Target (Enemy):
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Target : MonoBehaviour

public float health = 50f; //Enemy health
public float damage = 20f; //Damage done to the Player
Animator anim; //Reference to Enemey Animator
float startDelay = 1.5f; //Start delay of death animation
public Transform player; //Reference to Player position
FirstPersonController fpc; //Reference to Player Control script
float enemyGravity;
AudioSource aSource;
public AudioClip walkSound;
public AudioClip attackSound;

void Start()
anim = GetComponent();
player = GameObject.FindGameObjectWithTag(“Player”).transform;
fpc = player.transform.GetComponent();
aSource = GetComponent();

private void Update()
//Enemy animation
anim.SetBool(“isRunning”, false);
anim.SetBool(“isIdle”, true);
anim.SetBool(“isAIdle”, false);
anim.SetBool(“isWalking”, false);
anim.SetBool(“Dying”, false);
anim.SetBool(“Attack”, false);
anim.SetBool(“gotHit”, false);
enemyGravity += Physics.gravity.y * Time.deltaTime;
Vector3 direction = player.position – this.transform.position; //Determining enemy position from Player
float angle = Vector3.Angle(direction, this.transform.forward); //Enemy moves forward

//Checks distance from player
if (Vector3.Distance(player.position, this.transform.position) < 20 && angle = 0 && Time.timeScale >= 1)

if (health 2)
this.transform.Translate(0, 0, .09f);
anim.SetBool(“isRunning”, false);
anim.SetBool(“isIdle”, false);
anim.SetBool(“isAIdle”, false);
anim.SetBool(“isWalking”, true);
anim.SetBool(“Dying”, false);
anim.SetBool(“Attack”, false);
anim.SetBool(“gotHit”, false);

//Attacks the player when in range
else if (direction.magnitude