Skip to content

Commit

Permalink
Added menu/pause function
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyN3 committed Jan 11, 2022
1 parent 25bfa47 commit f0a1bb4
Show file tree
Hide file tree
Showing 8 changed files with 1,117 additions and 456 deletions.
1,435 changes: 1,025 additions & 410 deletions Assets/Scenes/MapOne.unity

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions Assets/Scripts/CanvasController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;

public class CanvasController : MonoBehaviour
{
public GameObject endScreen;
public GameObject pauseScreen;

void Awake()
{
if(endScreen == null)
endScreen = GameObject.Find("EndScreen");
if(pauseScreen == null)
pauseScreen = GameObject.Find("PauseScreen");

endScreen.SetActive(false);
pauseScreen.SetActive(false);
}

public void OnGameEnd(char winner)
{
endScreen.SetActive(true);
endScreen.transform.Find("Winner").GetComponent<TextMeshProUGUI>().text = winner == 'R' ? "Red Team" : "Blue Team";
}

public bool OnPause()
{
pauseScreen.SetActive(true);
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
return true;
}

public bool OnUnPause()
{
pauseScreen.SetActive(false);
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
return false;
}
}
File renamed without changes.
24 changes: 0 additions & 24 deletions Assets/Scripts/EndController.cs

This file was deleted.

4 changes: 2 additions & 2 deletions Assets/Scripts/GunSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ private void MyInput()
player.DoSound(2, transform.position);
}

if(Input.GetKeyDown(KeyCode.P))
LobbyManager.Instance.PrintList();
// if(Input.GetKeyDown(KeyCode.P))
// LobbyManager.Instance.PrintList();
}

private void Shoot()
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/Networking/NetworkingPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,13 @@ public override void TeamScore(RpcArgs args)

public override void EndGame(RpcArgs args)
{
GameObject endScreen = canvasController.GetComponent<EndController>().endScreen;
GameObject endScreen = canvasController.GetComponent<CanvasController>().endScreen;

char winner = args.GetNext<char>();
endScreen.SetActive(true);
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;

canvasController.GetComponent<EndController>().OnGameEnd(winner);
canvasController.GetComponent<CanvasController>().OnGameEnd(winner);
}
}
17 changes: 14 additions & 3 deletions Assets/Scripts/PlayerMovement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public class PlayerMovement : MonoBehaviour
private Vector3 normalVector = Vector3.up;
private Vector3 wallNormalVector;

private CanvasController canvasController;

void Awake()
{
rb = GetComponent<Rigidbody>();
Expand All @@ -58,18 +60,27 @@ void Start()
playerScale = transform.localScale;
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;

canvasController = GameObject.Find("Canvas_UI").GetComponent<CanvasController>();
}

private void FixedUpdate()
{
Movement();
}

private bool isPause = false;
private void Update()
{
MyInput();
Look();
//Movement();
if(Input.GetKeyDown(KeyCode.Escape))
isPause = isPause ? canvasController.OnUnPause() : canvasController.OnPause();

if(!isPause)
{
MyInput();
Look();
//Movement();
}
}

private float desiredX;
Expand Down
46 changes: 31 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,46 @@
<div align="center">
<h1>🔵 FaIlers 🔴</h1>
<b>Group 28</b>
<br>
<img src="Assets/Images/MenuScreen.png">

<img src="Assets/Images/MenuScreen.png" width=80%>
</div>

## Index
- [Contributors](#contributors)
- [Summary](#summary)
- [Rules](#rules)
- [Controls](#controls)
- [Video Demo](#video-demo)

## Contributors:
## Contributors
- [Anthony Nguyen](https://github.com/AnthonyN3)
- [Sebastian Maj](https://github.com/SebastianMaj) (Note: ``KerryuCC`` is also Sebastian)
- [Sebastian Maj](https://github.com/SebastianMaj)

## Summary
Fallers is a simple two team capture the flag first person shooter game. The has a simplistic and minimalistic design, heavily emphasizing on
the movement, flow, functionality, and physics. The online networking is done using ``Forge``, a open source networking system that has very good integration with the Unity Game Engine. The basic premise of the networking is that one of the players is the host, and the rest are the clients (no dedicated servers).

## Rules
- Two teams (Blue & Red)
- Players are automatically assigned to the team that has the least amount of players (team blue if equal)
- Friendly fire is off
- First to 10 flag captures (points) wins

## Controls
Game interaction is done on a traditional mouse and keyboard. The default controls have the player movement and interaction keys on the keyboard, while the mouse controls the screen movement and weapon shooting

## Controls:
- ``W`` - ``Move Up``
- ``A`` - ``Move Left``
- ``S`` - ``Move Back``
- ``D`` - ``Move Right``
- ``SPACE`` - ``Jump``
- ``CTRL`` - ``Crouch/Slide``
- ``SHIFT`` - ``Walk``
- ``MOUSE1`` - ``Shoot``
- ``E`` - ``PickUp``
| Keys | Description |
| :---: | :--- |
| `W` | Move Up|
| `A` | Move Left |
| `S` | Move Back |
| `D` | Move Right |
| `SPACE` | Jump |
| `CTRL` | Crouch. Can be used to slide if you build enough movement speed |
| `SHIFT` | Movement is slowed down (walk) |
| `Mouse` | Look around (move the screen) |
| `MOUSE1` | Attack/Fire held weapon |
| `E` | PickUp a weapon|
| `ESC` | Bring up the menu screen (pause) |

## Video Demo
https://youtu.be/mx9I1ZhM7YQ

0 comments on commit f0a1bb4

Please sign in to comment.