Skip to content

Commit

Permalink
Add basic "pause" menu
Browse files Browse the repository at this point in the history
  • Loading branch information
toberge committed Mar 17, 2024
1 parent 47f3d12 commit 08969fd
Show file tree
Hide file tree
Showing 11 changed files with 1,007 additions and 96 deletions.
715 changes: 709 additions & 6 deletions Assets/Prefabs/Input/Player.prefab

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Assets/Scenes/CraterTown.unity
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 662445327}
m_IndirectSpecularColor: {r: 0.09672264, g: 0.24035963, b: 0.4926994, a: 1}
m_IndirectSpecularColor: {r: 0.03905226, g: 0.20194778, b: 0.4885325, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down
204 changes: 145 additions & 59 deletions Assets/ScriptableObjects/Input/PlayerControls.inputactions
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Exit",
"type": "Button",
"id": "59e83c07-8e52-4bf8-9438-5a6d37054de2",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
Expand Down Expand Up @@ -284,7 +293,7 @@
{
"name": "",
"id": "0030f558-1dce-4039-95e4-2c065ead1db1",
"path": "<Keyboard>/escape",
"path": "<Keyboard>/backspace",
"interactions": "",
"processors": "",
"groups": "MouseAndKeyboard",
Expand Down Expand Up @@ -478,6 +487,50 @@
"action": "LeftTab",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "9a1572fe-6205-45fc-8244-3502f75c7d39",
"path": "<Gamepad>/select",
"interactions": "",
"processors": "",
"groups": "",
"action": "Exit",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "8f4504be-133a-4f66-b0d3-793290c87279",
"path": "<Gamepad>/start",
"interactions": "",
"processors": "",
"groups": "",
"action": "Exit",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "846526c8-752a-4905-9e41-6ec6d2d80a37",
"path": "<Keyboard>/escape",
"interactions": "",
"processors": "",
"groups": "",
"action": "Exit",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "3670069a-df39-40ea-8a7c-c4b797451183",
"path": "<Keyboard>/p",
"interactions": "",
"processors": "",
"groups": "",
"action": "Exit",
"isComposite": false,
"isPartOfComposite": false
}
]
},
Expand All @@ -494,15 +547,6 @@
"interactions": "",
"initialStateCheck": false
},
{
"name": "Cancel",
"type": "Button",
"id": "6c813086-0914-48e7-a994-f4c36f04f63c",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Move",
"type": "Value",
Expand Down Expand Up @@ -556,6 +600,15 @@
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Exit",
"type": "Button",
"id": "6c813086-0914-48e7-a994-f4c36f04f63c",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
Expand All @@ -581,28 +634,6 @@
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "898c171c-67f9-4de3-b99e-3eea3e5a4dda",
"path": "<Gamepad>/buttonEast",
"interactions": "",
"processors": "",
"groups": "Gamepad",
"action": "Cancel",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "fe8cd325-d420-4946-a7f0-40e4e1c72e6e",
"path": "<Keyboard>/escape",
"interactions": "",
"processors": "",
"groups": "MouseAndKeyboard",
"action": "Cancel",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "65cc362b-78a9-46ba-b196-d471cbc76387",
Expand Down Expand Up @@ -800,6 +831,50 @@
"action": "Interact",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "898c171c-67f9-4de3-b99e-3eea3e5a4dda",
"path": "<Gamepad>/select",
"interactions": "",
"processors": "",
"groups": "Gamepad",
"action": "Exit",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "b5e45b4a-8d1c-4a6b-90af-6270f64a9acf",
"path": "<Gamepad>/start",
"interactions": "",
"processors": "",
"groups": "",
"action": "Exit",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "fe8cd325-d420-4946-a7f0-40e4e1c72e6e",
"path": "<Keyboard>/escape",
"interactions": "",
"processors": "",
"groups": "MouseAndKeyboard",
"action": "Exit",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "be69b80f-1ccc-473a-9084-888986ef60df",
"path": "<Keyboard>/p",
"interactions": "",
"processors": "",
"groups": "",
"action": "Exit",
"isComposite": false,
"isPartOfComposite": false
}
]
},
Expand All @@ -826,27 +901,27 @@
"initialStateCheck": true
},
{
"name": "Cancel",
"name": "Select",
"type": "Button",
"id": "9e0bf922-98f3-49e8-9ea8-7897bbb5249f",
"id": "81e31669-1c45-46b3-b49d-6daa89095b81",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Select",
"name": "Interact",
"type": "Button",
"id": "81e31669-1c45-46b3-b49d-6daa89095b81",
"id": "360c3d67-b75e-4f1a-8700-e3d62ef4f857",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Interact",
"name": "Exit",
"type": "Button",
"id": "360c3d67-b75e-4f1a-8700-e3d62ef4f857",
"id": "9e0bf922-98f3-49e8-9ea8-7897bbb5249f",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
Expand Down Expand Up @@ -944,67 +1019,78 @@
},
{
"name": "",
"id": "4b0e4d83-9aaf-4d27-8ef7-830284a247cc",
"path": "<Gamepad>/buttonEast",
"id": "5d89d078-c0ba-4983-9a06-ce3dd87d1f5d",
"path": "<Gamepad>/buttonSouth",
"interactions": "",
"processors": "",
"groups": "Gamepad",
"action": "Cancel",
"action": "Select",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "56f3ff90-eaed-417f-806b-5c5933c8b942",
"path": "<Keyboard>/escape",
"id": "6ffc950e-93eb-4518-b7b3-03abbd49ce61",
"path": "<Keyboard>/space",
"interactions": "",
"processors": "",
"groups": "MouseAndKeyboard",
"action": "Cancel",
"action": "Select",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "5d89d078-c0ba-4983-9a06-ce3dd87d1f5d",
"path": "<Gamepad>/buttonSouth",
"id": "221ae938-7c34-4327-a946-e4033836ec8b",
"path": "<Gamepad>/buttonNorth",
"interactions": "",
"processors": "",
"groups": "Gamepad",
"action": "Select",
"groups": "",
"action": "Interact",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "6ffc950e-93eb-4518-b7b3-03abbd49ce61",
"path": "<Keyboard>/space",
"id": "74ac9ab7-57d5-4345-94df-a44090407788",
"path": "<Keyboard>/f",
"interactions": "",
"processors": "",
"groups": "MouseAndKeyboard",
"action": "Select",
"groups": "",
"action": "Interact",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "221ae938-7c34-4327-a946-e4033836ec8b",
"path": "<Gamepad>/buttonNorth",
"id": "4b0e4d83-9aaf-4d27-8ef7-830284a247cc",
"path": "<Gamepad>/select",
"interactions": "",
"processors": "",
"groups": "",
"action": "Interact",
"groups": "Gamepad",
"action": "Exit",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "74ac9ab7-57d5-4345-94df-a44090407788",
"path": "<Keyboard>/f",
"id": "55d97c0c-c237-4916-8da5-6e4d5ee4e368",
"path": "<Gamepad>/start",
"interactions": "",
"processors": "",
"groups": "",
"action": "Interact",
"action": "Exit",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "56f3ff90-eaed-417f-806b-5c5933c8b942",
"path": "<Keyboard>/escape",
"interactions": "",
"processors": "",
"groups": "MouseAndKeyboard",
"action": "Exit",
"isComposite": false,
"isPartOfComposite": false
}
Expand Down
9 changes: 7 additions & 2 deletions Assets/Scripts/Augment/GunController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,18 @@ public void SetPlayer(PlayerManager player)
Player = player;
if (!Player.inputManager)
return;
Player.inputManager.onZoomPerformed += OnZoom;
Player.inputManager.onZoomCanceled += OnZoomCanceled;
SetPlayerInput(Player.inputManager);
Player.inputManager.GetComponentInChildren<JiggleBone>().body = Player.GetComponent<PlayerMovement>().Body;
if (MatchController.Singleton)
MatchController.Singleton.onRoundEnd += CancelZoom;
}

public void SetPlayerInput(InputManager input)
{
input.onZoomPerformed += OnZoom;
input.onZoomCanceled += OnZoomCanceled;
}

private AugmentAnimator barrelAnimator;

private bool isFiring = false;
Expand Down
8 changes: 8 additions & 0 deletions Assets/Scripts/Control&Input/InputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class InputManager : MonoBehaviour
// Menu-related
public InputEvent onSelect;
public InputEvent onCancel;
public InputEvent onExit;
public InputEvent onLeftTab;
public InputEvent onRightTab;
public InputEvent onAnyKey;
Expand Down Expand Up @@ -79,6 +80,7 @@ public void AddListeners()
playerInput.actions["Join"].performed += AnyKey;
playerInput.actions["Select"].performed += Select;
playerInput.actions["Cancel"].performed += Cancel;
playerInput.actions["Exit"].performed += Exit;
playerInput.actions["Move"].performed += Move;
playerInput.actions["Move"].canceled += Move;
playerInput.actions["LeftTab"].performed += LeftTab;
Expand Down Expand Up @@ -159,6 +161,7 @@ private void RemoveAllListeners()
// Abusing that empty delegate bodies are defined as null to remove all invocation lists.
onSelect = null;
onCancel = null;
onExit = null;
onMovePerformed = null;
onMoveCanceled = null;
onLeftTab = null;
Expand Down Expand Up @@ -196,6 +199,11 @@ private void Cancel(InputAction.CallbackContext ctx)
onCancel?.Invoke(ctx);
}

private void Exit(InputAction.CallbackContext ctx)
{
onExit?.Invoke(ctx);
}

private void LeftTab(InputAction.CallbackContext ctx)
{
onLeftTab?.Invoke(ctx);
Expand Down
Loading

0 comments on commit 08969fd

Please sign in to comment.