added pause menu

This commit is contained in:
naomi-rc 2022-05-15 00:42:34 -04:00
parent 7fe6cc9948
commit fbd116e90b
18 changed files with 22132 additions and 22 deletions

View File

@ -0,0 +1,53 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: PauseMenu
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves: []
m_SampleRate: 60
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings: []
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 1
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4c2010dc8f9408842b0fa215c5b04483
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,12 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: PauseMenu
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorLayers: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8e5cd162fe88c4144a55c0e39b4d27f2
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Art/UI/icon_alert_exclamation.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/Art/UI/icon_alert_exclamation.png.meta (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/Art/UI/icon_alert_triangle.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/Art/UI/icon_alert_triangle.png.meta (Stored with Git LFS) Normal file

Binary file not shown.

174
Assets/InputMaster.cs Normal file
View File

@ -0,0 +1,174 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.3.0
// from Assets/InputMaster.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
public partial class @InputMaster : IInputActionCollection2, IDisposable
{
public InputActionAsset asset { get; }
public @InputMaster()
{
asset = InputActionAsset.FromJson(@"{
""name"": ""InputMaster"",
""maps"": [
{
""name"": ""Menu"",
""id"": ""725208ea-b0f7-41fe-982e-4e4f1968f986"",
""actions"": [
{
""name"": ""Pause"",
""type"": ""Button"",
""id"": ""6c625271-9120-4d38-a871-07fa3656839f"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
}
],
""bindings"": [
{
""name"": """",
""id"": ""9af28864-137e-4371-9bba-31d99ca1d162"",
""path"": ""<Keyboard>/space"",
""interactions"": ""Press"",
""processors"": """",
""groups"": """",
""action"": ""Pause"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""0b994463-6cbd-4144-9d18-a6cd898b2e06"",
""path"": ""<Keyboard>/p"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Pause"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""f6e7edd8-d5b2-4e34-b651-eeeabdc4a16b"",
""path"": ""<Keyboard>/escape"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Pause"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
],
""controlSchemes"": []
}");
// Menu
m_Menu = asset.FindActionMap("Menu", throwIfNotFound: true);
m_Menu_Pause = m_Menu.FindAction("Pause", throwIfNotFound: true);
}
public void Dispose()
{
UnityEngine.Object.Destroy(asset);
}
public InputBinding? bindingMask
{
get => asset.bindingMask;
set => asset.bindingMask = value;
}
public ReadOnlyArray<InputDevice>? devices
{
get => asset.devices;
set => asset.devices = value;
}
public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
public bool Contains(InputAction action)
{
return asset.Contains(action);
}
public IEnumerator<InputAction> GetEnumerator()
{
return asset.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public void Enable()
{
asset.Enable();
}
public void Disable()
{
asset.Disable();
}
public IEnumerable<InputBinding> bindings => asset.bindings;
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
{
return asset.FindAction(actionNameOrId, throwIfNotFound);
}
public int FindBinding(InputBinding bindingMask, out InputAction action)
{
return asset.FindBinding(bindingMask, out action);
}
// Menu
private readonly InputActionMap m_Menu;
private IMenuActions m_MenuActionsCallbackInterface;
private readonly InputAction m_Menu_Pause;
public struct MenuActions
{
private @InputMaster m_Wrapper;
public MenuActions(@InputMaster wrapper) { m_Wrapper = wrapper; }
public InputAction @Pause => m_Wrapper.m_Menu_Pause;
public InputActionMap Get() { return m_Wrapper.m_Menu; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
public bool enabled => Get().enabled;
public static implicit operator InputActionMap(MenuActions set) { return set.Get(); }
public void SetCallbacks(IMenuActions instance)
{
if (m_Wrapper.m_MenuActionsCallbackInterface != null)
{
@Pause.started -= m_Wrapper.m_MenuActionsCallbackInterface.OnPause;
@Pause.performed -= m_Wrapper.m_MenuActionsCallbackInterface.OnPause;
@Pause.canceled -= m_Wrapper.m_MenuActionsCallbackInterface.OnPause;
}
m_Wrapper.m_MenuActionsCallbackInterface = instance;
if (instance != null)
{
@Pause.started += instance.OnPause;
@Pause.performed += instance.OnPause;
@Pause.canceled += instance.OnPause;
}
}
}
public MenuActions @Menu => new MenuActions(this);
public interface IMenuActions
{
void OnPause(InputAction.CallbackContext context);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 36bb7aa027f269a40ac0c1f0726cd204
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,56 @@
{
"name": "InputMaster",
"maps": [
{
"name": "Menu",
"id": "725208ea-b0f7-41fe-982e-4e4f1968f986",
"actions": [
{
"name": "Pause",
"type": "Button",
"id": "6c625271-9120-4d38-a871-07fa3656839f",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
{
"name": "",
"id": "9af28864-137e-4371-9bba-31d99ca1d162",
"path": "<Keyboard>/space",
"interactions": "Press",
"processors": "",
"groups": "",
"action": "Pause",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "0b994463-6cbd-4144-9d18-a6cd898b2e06",
"path": "<Keyboard>/p",
"interactions": "",
"processors": "",
"groups": "",
"action": "Pause",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "f6e7edd8-d5b2-4e34-b651-eeeabdc4a16b",
"path": "<Keyboard>/escape",
"interactions": "",
"processors": "",
"groups": "",
"action": "Pause",
"isComposite": false,
"isPartOfComposite": false
}
]
}
],
"controlSchemes": []
}

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 5de64a295a15c8f4289b6fdfcac5b5f8
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
generateWrapperCode: 1
wrapperCodePath:
wrapperClassName:
wrapperCodeNamespace:

21478
Assets/Scenes/NaomiScene.unity Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 82fe130aef9b792479ad11602bcfa343
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,73 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
public class PauseMenu : MonoBehaviour
{
public static bool IsPaused = false;
[SerializeField] InputMaster inputAction;
[SerializeField] GameObject pauseMenu;
private void Awake()
{
inputAction = new InputMaster();
inputAction.Menu.Pause.performed += _ => ExecutePauseUnpause();
Debug.Log("In Pause Awake");
}
private void ExecutePauseUnpause()
{
Debug.Log("ExecutePauseUnpause");
if (IsPaused)
ResumeGame();
else
PauseGame();
}
private void OnEnable()
{
inputAction.Enable();
}
private void OnDisable()
{
inputAction.Disable();
}
void PauseGame()
{
Debug.Log("PauseGame");
Time.timeScale = 0f;
IsPaused = true;
pauseMenu.SetActive(true);
}
public void ResumeGame()
{
Debug.Log("ResumeGame");
Time.timeScale = 1f;
IsPaused = false;
pauseMenu.SetActive(false);
}
public void LoadMenu()
{
Time.timeScale = 1f;
Debug.Log("LoadMenu");
SceneManager.LoadScene(0);
}
public void QuitGame()
{
Debug.Log("QuitGame");
Application.Quit();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 28eeeff0d050a054b922df891e1740a3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -2,14 +2,17 @@
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: LiberationSans SDF - Drop Shadow
m_Shader: {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, type: 3}
m_ShaderKeywords: OUTLINE_ON UNDERLAY_ON
m_ValidKeywords:
- OUTLINE_ON
- UNDERLAY_ON
m_InvalidKeywords: []
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
@ -32,14 +35,14 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 28684132378477856, guid: 8f586378b4e144a9851e7b34d9b748ee,
type: 2}
m_Texture: {fileID: 28684132378477856, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OutlineTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _Ambient: 0.5
- _Bevel: 0.5
@ -50,6 +53,7 @@ Material:
- _BumpFace: 0
- _BumpOutline: 0
- _ColorMask: 15
- _CullMode: 0
- _Diffuse: 0.5
- _DiffusePower: 1
- _FaceDilate: 0.1
@ -71,7 +75,7 @@ Material:
- _Reflectivity: 10
- _ScaleRatioA: 0.9
- _ScaleRatioB: 0.73125
- _ScaleRatioC: 0.64125
- _ScaleRatioC: 0.6107143
- _ScaleX: 1
- _ScaleY: 1
- _ShaderFlags: 0
@ -85,8 +89,8 @@ Material:
- _TextureHeight: 1024
- _TextureWidth: 1024
- _UnderlayDilate: 0
- _UnderlayOffsetX: 0.5
- _UnderlayOffsetY: -0.5
- _UnderlayOffsetX: 1
- _UnderlayOffsetY: -1
- _UnderlaySoftness: 0.05
- _VertexOffsetX: 0
- _VertexOffsetY: 0
@ -104,3 +108,4 @@ Material:
- _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
- _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5}
m_BuildTextureStacks: []

File diff suppressed because one or more lines are too long