Professional Documents
Culture Documents
Shooter Arena
a game
By:
Pardeep Kumar : 1818568
Deepak Walia : 1818548
Gurbhej Singh : 1818550
CSE 2018-2022
1
Table of Contents
9 Credits 34
2
ABOUT GAME !
This Game is purely for entertainment purpose, an ongoing project created in Unity
3D. the whole idea is based on Theme of Alien Invasion environment. This First-
Person Shooter game themed on Minecraft Graphics Structured on basic design,
simple Graphics. No heavy graphics components are being used in the Game.
Game can run on Simple System aka’ low end system. The Game is developed
using Unity 3D, Blender and Visual Studio 2019. whole code and documentation
later explained in this document of project Report. Every resource is enclosed
along the document and URLs are enclosed.
3
Benefits of gaming !
as it already said, excess of everything is bad So, don’t overplay it, By the
way it’s already a three-mission game !
4
Tools used in Game Development
Unity is, simply put, the world’s most popular game engine. It packs a ton of
features together and is flexible enough to make almost any game you can imagine.
With unrivaled cross-platform features, Unity is popular with both hobby developers
and AAA studios. It’s been used to create games like Pokémon Go, Heathstone, Rim
world, Cuphead, and plenty more.
While 3D is in the name, Unity 3D also packs tools for 2D game development.
Programmers love it because of the C# scripting API and built-in Visual Studio
integration. Unity also offers JavaScript as a scripting language
and MonoDevelop as an IDE to those who want an alternative to Visual Studio.
Unity is, simply put, the world’s most popular game engine. It packs a ton of features
together and is flexible enough to make almost any game you can imagine. With
unrivaled cross-platform features, Unity is popular with both hobby developers and
AAA studios. It’s been used to create games like Pokémon Go, Hearthstone, Rim
world, Cuphead, and plenty more.
While 3D is in the name, Unity 3D also packs tools for 2D game development.
5
Programmers love it because of the C# scripting API and built-in Visual Studio
integration. Unity also offers JavaScript as a scripting language
and MonoDevelop as an IDE to those who want an alternative to Visual Studio.
Visual Studio is one of the most famous IDEs has been using for the last few years.
Microsoft developed it. It is used to create a computer program, web applications,
and EXE files, etc. The first version of its kind was launched in 1997. And now the
latest version available in the market is Visual Studio 2019. Visual Studio 2019 was
released on April 2nd, 2019. There are so many advanced features that will be
included in this version.
6
choose the ‘modify’ option and in the workload screen check the ‘Incredibuild –
Build acceleration’ checkbox.
Blender
Blender is the free and open-source 3D creation suite. It supports the entirety of the
3D pipeline—modeling, rigging, animation, simulation, rendering, compositing and
motion tracking, even video editing and game creation. Advanced users employ
Blender’s API for Python scripting to customize the application and write
specialized tools; often these are included in Blender’s future releases. Blender is
well suited to individuals and small studios who benefit from its unified pipeline and
responsive development process. Examples from many Blender-based projects are
available in the showcase.
Blender is cross-platform and runs equally well on Linux, Windows, and Macintosh
computers. Its interface uses OpenGL to provide a consistent experience. To confirm
specific compatibility, the list of supported platforms indicates those regularly tested
by the development team.
As a community-driven project under the GNU General Public License (GPL), the
public is empowered to make small and large changes to the code base, which leads
to new features, responsive bug fixes, and better usability. Blender has no price tag,
but you can invest, participate, and help to advance a powerful collaborative tool:
Blender is your own 3D software.
7
Approach used
Test screen
setup
Prepared Scripts
using C# for each
Object or Asset taken
in Game using Visual
studio
8
System Requirements
• Version: 1.0
• Product Name: Shooter Arena
• CPU: i3 4th generation
• RAM: 2 GB
• OS: Windows 7, Windows 8.1, Windows 10 x86_64
• GPU: No GPU Required
• DirectX Must required to play without errors!
Script Files
9
Game files after Build
10
Maps Included in game
*Dusk Crawl
11
Enemy variable:
12
*Pirate Kit
13
Screenshots from game
14
15
Script Codes
Player Controller
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
16
// Start is called before the first frame update
void Start()
{
currentGun--;
SwitchGun();
gunStartPos = gunHolder.localPosition;
}
//store y velocity
float yStore = moveInput.y;
if (Input.GetKey(KeyCode.LeftShift))
{
moveInput = moveInput * runSpeed;
}
else
{
moveInput = moveInput * moveSpeed;
}
moveInput.y = yStore;
if (charCon.isGrounded)
{
moveInput.y = Physics.gravity.y * gravityModifier * Time.deltaTime;
}
if (canJump)
{
canDoubleJump = false;
}
//Handle Jumping
if (Input.GetKeyDown(KeyCode.Space) && canJump)
{
moveInput.y = jumpPower;
17
canDoubleJump = true;
AudioManager.instance.PlaySFX(8);
}
else if (canDoubleJump && Input.GetKeyDown(KeyCode.Space))
{
moveInput.y = jumpPower;
canDoubleJump = false;
AudioManager.instance.PlaySFX(8);
}
if(bounce)
{
bounce = false;
moveInput.y = bounceAmount;
canDoubleJump = true;
charCon.Move(moveInput * Time.deltaTime);
if (invertX)
{
mouseInput.x = -mouseInput.x;
}
if (invertY)
{
mouseInput.y = -mouseInput.y;
}
transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x,
transform.rotation.eulerAngles.y + mouseInput.x, transform.rotation.eulerAngles.z);
muzzleFlash.SetActive(false);
//Handle Shooting
//single shots
if (Input.GetMouseButtonDown(0) && activeGun.fireCounter <= 0)
{
RaycastHit hit;
if (Physics.Raycast(camTrans.position, camTrans.forward, out hit, 50f))
{
if (Vector3.Distance(camTrans.position, hit.point) > 2f)
{
18
firePoint.LookAt(hit.point);
}
}
else
{
firePoint.LookAt(camTrans.position + (camTrans.forward * 30f));
}
//repeating shots
if (Input.GetMouseButton(0) && activeGun.canAutoFire)
{
if (activeGun.fireCounter <= 0)
{
FireShot();
}
}
if (Input.GetKeyDown(KeyCode.Tab))
{
SwitchGun();
}
if (Input.GetMouseButtonDown(1))
{
CameraController.instance.ZoomIn(activeGun.zoomAmount);
}
if (Input.GetMouseButton(1))
{
gunHolder.position = Vector3.MoveTowards(gunHolder.position,
adsPoint.position, adsSpeed * Time.deltaTime);
}
else
{
gunHolder.localPosition = Vector3.MoveTowards(gunHolder.localPosition,
gunStartPos, adsSpeed * Time.deltaTime);
}
if (Input.GetMouseButtonUp(1))
{
CameraController.instance.ZoomOut();
}
anim.SetFloat("moveSpeed", moveInput.magnitude);
anim.SetBool("onGround", canJump);
}
}
19
public void FireShot()
{
if (activeGun.currentAmmo > 0)
{
activeGun.currentAmmo--;
activeGun.fireCounter = activeGun.fireRate;
muzzleFlash.SetActive(true);
}
}
currentGun++;
activeGun = allGuns[currentGun];
activeGun.gameObject.SetActive(true);
firePoint.position = activeGun.firepoint.position;
}
if(unlockableGuns.Count > 0)
{
for(int i = 0; i < unlockableGuns.Count; i++)
{
if(unlockableGuns[i].gunName == gunToAdd)
{
gunUnlocked = true;
allGuns.Add(unlockableGuns[i]);
unlockableGuns.RemoveAt(i);
i = unlockableGuns.Count;
}
}
20
if(gunUnlocked)
{
currentGun = allGuns.Count - 2;
SwitchGun();
}
}
Gun Script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
21
UIController.instance.ammoText.text = "AMMO: " + currentAmmo;
}
}
LeveExit.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
StartCoroutine(EndLevelCo());
AudioManager.instance.PlayLevelVictory();
}
}
SceneManager.LoadScene(nextLevel);
}
}
22
Main Menu
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
PlayerPrefs.SetString("CurrentLevel", "");
23
Pause Screen
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
PlayerPrefs.SetString("CurrentLevel", "");
24
Target Movement
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
if(shouldRotate)
{
transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles + new
Vector3(0f, rotateSpeed * Time.deltaTime, 0f));
}
}
}
25
UI controller
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
if(shouldRotate)
{
transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles + new
Vector3(0f, rotateSpeed * Time.deltaTime, 0f));
}
}
}
26
Victory Screen
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
Cursor.lockState = CursorLockMode.None;
}
textBox.SetActive(true);
returnButton.SetActive(true);
}
}
27
Game Manager
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
[HideInInspector]
public bool levelEnding;
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
Cursor.lockState = CursorLockMode.Locked;
28
Time.timeScale = 1f;
PlayerController.instance.footstepFast.Play();
PlayerController.instance.footstepSlow.Play();
} else
{
UIController.instance.pauseScreen.SetActive(true);
Cursor.lockState = CursorLockMode.None;
Time.timeScale = 0f;
PlayerController.instance.footstepFast.Stop();
PlayerController.instance.footstepSlow.Stop();
}
}
}
29
Enemy Controller
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
shootTimeCounter = timeToShoot;
shotWaitCounter = waitBetweenShots;
}
if (!chasing)
{
if (Vector3.Distance(transform.position, targetPoint) < distanceToChase)
{
chasing = true;
shootTimeCounter = timeToShoot;
shotWaitCounter = waitBetweenShots;
}
if (chaseCounter > 0)
{
30
chaseCounter -= Time.deltaTime;
if (chaseCounter <= 0)
{
agent.destination = startPoint;
}
}
chaseCounter = keepChasingTime;
}
} else
{
wasShot = false;
}
if (shotWaitCounter > 0)
{
shotWaitCounter -= Time.deltaTime;
if(shotWaitCounter <= 0)
{
shootTimeCounter = timeToShoot;
}
anim.SetBool("isMoving", true);
} else {
if (PlayerController.instance.gameObject.activeInHierarchy)
{
shootTimeCounter -= Time.deltaTime;
31
if (shootTimeCounter > 0)
{
fireCount -= Time.deltaTime;
if (fireCount <= 0)
{
fireCount = fireRate;
firePoint.LookAt(PlayerController.instance.transform.position
+ new Vector3(0f, 1.2f, 0f));
Vector3 targetDir =
PlayerController.instance.transform.position - transform.position;
float angle = Vector3.SignedAngle(targetDir,
transform.forward, Vector3.up);
Instantiate(bullet, firePoint.position,
firePoint.rotation);
anim.SetTrigger("fireShot");
}
else
{
shotWaitCounter = waitBetweenShots;
}
}
agent.destination = transform.position;
}
else
{
shotWaitCounter = waitBetweenShots;
}
}
anim.SetBool("isMoving", false);
}
}
}
chasing = true;
}
}
32
Camera Controller
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
33
Bullet Controller
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
lifeTime -= Time.deltaTime;
if(lifeTime <= 0)
{
Destroy(gameObject);
}
}
other.gameObject.GetComponent<EnemyHealthController>().DamageEnemy(damage);
}
other.transform.parent.GetComponent<EnemyHealthController>().DamageEnemy(damage * 2);
Debug.Log("Headshot hit");
}
PlayerHealthController.instance.DamagePlayer(damage);
}
34
Destroy(gameObject);
Instantiate(impactEffect, transform.position + (transform.forward * (-moveSpeed *
Time.deltaTime)), transform.rotation);
}
}
35
Credits n Sources
https://www.blender.org/
https://visualstudio.microsoft.com/vs/
https://unity.com/
https://www.udemy.com/
Assets :
https://kenney.nl/
https://assetstore.unity.com/packages/tools/game-toolkits/game-creator-2-
203069?aid=1100l36uR&utm_campaign=unity_affiliate&utm_medium=affiliate&
utm_source=partnerize-linkmaker
36