Pauser Added + Fixed Bug
TODO: Stop Animations when Paused
This commit is contained in:
		@@ -64,6 +64,15 @@ namespace Input
 | 
				
			|||||||
                    ""processors"": """",
 | 
					                    ""processors"": """",
 | 
				
			||||||
                    ""interactions"": """",
 | 
					                    ""interactions"": """",
 | 
				
			||||||
                    ""initialStateCheck"": false
 | 
					                    ""initialStateCheck"": false
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    ""name"": ""Pause"",
 | 
				
			||||||
 | 
					                    ""type"": ""Button"",
 | 
				
			||||||
 | 
					                    ""id"": ""b110facd-253d-41ce-9de7-b589dc48cfc6"",
 | 
				
			||||||
 | 
					                    ""expectedControlType"": ""Button"",
 | 
				
			||||||
 | 
					                    ""processors"": """",
 | 
				
			||||||
 | 
					                    ""interactions"": """",
 | 
				
			||||||
 | 
					                    ""initialStateCheck"": false
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            ],
 | 
					            ],
 | 
				
			||||||
            ""bindings"": [
 | 
					            ""bindings"": [
 | 
				
			||||||
@@ -209,6 +218,28 @@ namespace Input
 | 
				
			|||||||
                    ""action"": ""Climb"",
 | 
					                    ""action"": ""Climb"",
 | 
				
			||||||
                    ""isComposite"": false,
 | 
					                    ""isComposite"": false,
 | 
				
			||||||
                    ""isPartOfComposite"": false
 | 
					                    ""isPartOfComposite"": false
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    ""name"": """",
 | 
				
			||||||
 | 
					                    ""id"": ""6a01ec66-e7a4-426a-8ee4-977d456b200c"",
 | 
				
			||||||
 | 
					                    ""path"": ""<Gamepad>/start"",
 | 
				
			||||||
 | 
					                    ""interactions"": """",
 | 
				
			||||||
 | 
					                    ""processors"": """",
 | 
				
			||||||
 | 
					                    ""groups"": ""Controller"",
 | 
				
			||||||
 | 
					                    ""action"": ""Pause"",
 | 
				
			||||||
 | 
					                    ""isComposite"": false,
 | 
				
			||||||
 | 
					                    ""isPartOfComposite"": false
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    ""name"": """",
 | 
				
			||||||
 | 
					                    ""id"": ""279efb3d-768d-49fd-91f5-c74ebe08c880"",
 | 
				
			||||||
 | 
					                    ""path"": ""<Keyboard>/escape"",
 | 
				
			||||||
 | 
					                    ""interactions"": """",
 | 
				
			||||||
 | 
					                    ""processors"": """",
 | 
				
			||||||
 | 
					                    ""groups"": ""KeyBoard"",
 | 
				
			||||||
 | 
					                    ""action"": ""Pause"",
 | 
				
			||||||
 | 
					                    ""isComposite"": false,
 | 
				
			||||||
 | 
					                    ""isPartOfComposite"": false
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            ]
 | 
					            ]
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -244,6 +275,7 @@ namespace Input
 | 
				
			|||||||
            m_PlayerControl_Jump = m_PlayerControl.FindAction("Jump", throwIfNotFound: true);
 | 
					            m_PlayerControl_Jump = m_PlayerControl.FindAction("Jump", throwIfNotFound: true);
 | 
				
			||||||
            m_PlayerControl_Interact = m_PlayerControl.FindAction("Interact", throwIfNotFound: true);
 | 
					            m_PlayerControl_Interact = m_PlayerControl.FindAction("Interact", throwIfNotFound: true);
 | 
				
			||||||
            m_PlayerControl_Climb = m_PlayerControl.FindAction("Climb", throwIfNotFound: true);
 | 
					            m_PlayerControl_Climb = m_PlayerControl.FindAction("Climb", throwIfNotFound: true);
 | 
				
			||||||
 | 
					            m_PlayerControl_Pause = m_PlayerControl.FindAction("Pause", throwIfNotFound: true);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public void Dispose()
 | 
					        public void Dispose()
 | 
				
			||||||
@@ -307,6 +339,7 @@ namespace Input
 | 
				
			|||||||
        private readonly InputAction m_PlayerControl_Jump;
 | 
					        private readonly InputAction m_PlayerControl_Jump;
 | 
				
			||||||
        private readonly InputAction m_PlayerControl_Interact;
 | 
					        private readonly InputAction m_PlayerControl_Interact;
 | 
				
			||||||
        private readonly InputAction m_PlayerControl_Climb;
 | 
					        private readonly InputAction m_PlayerControl_Climb;
 | 
				
			||||||
 | 
					        private readonly InputAction m_PlayerControl_Pause;
 | 
				
			||||||
        public struct PlayerControlActions
 | 
					        public struct PlayerControlActions
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            private @PlayerInput m_Wrapper;
 | 
					            private @PlayerInput m_Wrapper;
 | 
				
			||||||
@@ -315,6 +348,7 @@ namespace Input
 | 
				
			|||||||
            public InputAction @Jump => m_Wrapper.m_PlayerControl_Jump;
 | 
					            public InputAction @Jump => m_Wrapper.m_PlayerControl_Jump;
 | 
				
			||||||
            public InputAction @Interact => m_Wrapper.m_PlayerControl_Interact;
 | 
					            public InputAction @Interact => m_Wrapper.m_PlayerControl_Interact;
 | 
				
			||||||
            public InputAction @Climb => m_Wrapper.m_PlayerControl_Climb;
 | 
					            public InputAction @Climb => m_Wrapper.m_PlayerControl_Climb;
 | 
				
			||||||
 | 
					            public InputAction @Pause => m_Wrapper.m_PlayerControl_Pause;
 | 
				
			||||||
            public InputActionMap Get() { return m_Wrapper.m_PlayerControl; }
 | 
					            public InputActionMap Get() { return m_Wrapper.m_PlayerControl; }
 | 
				
			||||||
            public void Enable() { Get().Enable(); }
 | 
					            public void Enable() { Get().Enable(); }
 | 
				
			||||||
            public void Disable() { Get().Disable(); }
 | 
					            public void Disable() { Get().Disable(); }
 | 
				
			||||||
@@ -336,6 +370,9 @@ namespace Input
 | 
				
			|||||||
                    @Climb.started -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnClimb;
 | 
					                    @Climb.started -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnClimb;
 | 
				
			||||||
                    @Climb.performed -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnClimb;
 | 
					                    @Climb.performed -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnClimb;
 | 
				
			||||||
                    @Climb.canceled -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnClimb;
 | 
					                    @Climb.canceled -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnClimb;
 | 
				
			||||||
 | 
					                    @Pause.started -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnPause;
 | 
				
			||||||
 | 
					                    @Pause.performed -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnPause;
 | 
				
			||||||
 | 
					                    @Pause.canceled -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnPause;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                m_Wrapper.m_PlayerControlActionsCallbackInterface = instance;
 | 
					                m_Wrapper.m_PlayerControlActionsCallbackInterface = instance;
 | 
				
			||||||
                if (instance != null)
 | 
					                if (instance != null)
 | 
				
			||||||
@@ -352,6 +389,9 @@ namespace Input
 | 
				
			|||||||
                    @Climb.started += instance.OnClimb;
 | 
					                    @Climb.started += instance.OnClimb;
 | 
				
			||||||
                    @Climb.performed += instance.OnClimb;
 | 
					                    @Climb.performed += instance.OnClimb;
 | 
				
			||||||
                    @Climb.canceled += instance.OnClimb;
 | 
					                    @Climb.canceled += instance.OnClimb;
 | 
				
			||||||
 | 
					                    @Pause.started += instance.OnPause;
 | 
				
			||||||
 | 
					                    @Pause.performed += instance.OnPause;
 | 
				
			||||||
 | 
					                    @Pause.canceled += instance.OnPause;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -380,6 +420,7 @@ namespace Input
 | 
				
			|||||||
            void OnJump(InputAction.CallbackContext context);
 | 
					            void OnJump(InputAction.CallbackContext context);
 | 
				
			||||||
            void OnInteract(InputAction.CallbackContext context);
 | 
					            void OnInteract(InputAction.CallbackContext context);
 | 
				
			||||||
            void OnClimb(InputAction.CallbackContext context);
 | 
					            void OnClimb(InputAction.CallbackContext context);
 | 
				
			||||||
 | 
					            void OnPause(InputAction.CallbackContext context);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -40,6 +40,15 @@
 | 
				
			|||||||
                    "processors": "",
 | 
					                    "processors": "",
 | 
				
			||||||
                    "interactions": "",
 | 
					                    "interactions": "",
 | 
				
			||||||
                    "initialStateCheck": false
 | 
					                    "initialStateCheck": false
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    "name": "Pause",
 | 
				
			||||||
 | 
					                    "type": "Button",
 | 
				
			||||||
 | 
					                    "id": "b110facd-253d-41ce-9de7-b589dc48cfc6",
 | 
				
			||||||
 | 
					                    "expectedControlType": "Button",
 | 
				
			||||||
 | 
					                    "processors": "",
 | 
				
			||||||
 | 
					                    "interactions": "",
 | 
				
			||||||
 | 
					                    "initialStateCheck": false
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            ],
 | 
					            ],
 | 
				
			||||||
            "bindings": [
 | 
					            "bindings": [
 | 
				
			||||||
@@ -185,6 +194,28 @@
 | 
				
			|||||||
                    "action": "Climb",
 | 
					                    "action": "Climb",
 | 
				
			||||||
                    "isComposite": false,
 | 
					                    "isComposite": false,
 | 
				
			||||||
                    "isPartOfComposite": false
 | 
					                    "isPartOfComposite": false
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    "name": "",
 | 
				
			||||||
 | 
					                    "id": "6a01ec66-e7a4-426a-8ee4-977d456b200c",
 | 
				
			||||||
 | 
					                    "path": "<Gamepad>/start",
 | 
				
			||||||
 | 
					                    "interactions": "",
 | 
				
			||||||
 | 
					                    "processors": "",
 | 
				
			||||||
 | 
					                    "groups": "Controller",
 | 
				
			||||||
 | 
					                    "action": "Pause",
 | 
				
			||||||
 | 
					                    "isComposite": false,
 | 
				
			||||||
 | 
					                    "isPartOfComposite": false
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    "name": "",
 | 
				
			||||||
 | 
					                    "id": "279efb3d-768d-49fd-91f5-c74ebe08c880",
 | 
				
			||||||
 | 
					                    "path": "<Keyboard>/escape",
 | 
				
			||||||
 | 
					                    "interactions": "",
 | 
				
			||||||
 | 
					                    "processors": "",
 | 
				
			||||||
 | 
					                    "groups": "KeyBoard",
 | 
				
			||||||
 | 
					                    "action": "Pause",
 | 
				
			||||||
 | 
					                    "isComposite": false,
 | 
				
			||||||
 | 
					                    "isPartOfComposite": false
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            ]
 | 
					            ]
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -357,6 +357,23 @@ RectTransform:
 | 
				
			|||||||
  m_CorrespondingSourceObject: {fileID: 3493594456440070957, guid: 16d5d75ef61cad14f9aba53761139517, type: 3}
 | 
					  m_CorrespondingSourceObject: {fileID: 3493594456440070957, guid: 16d5d75ef61cad14f9aba53761139517, type: 3}
 | 
				
			||||||
  m_PrefabInstance: {fileID: 4238491769226202277}
 | 
					  m_PrefabInstance: {fileID: 4238491769226202277}
 | 
				
			||||||
  m_PrefabAsset: {fileID: 0}
 | 
					  m_PrefabAsset: {fileID: 0}
 | 
				
			||||||
 | 
					--- !u!1 &3858736020799332164 stripped
 | 
				
			||||||
 | 
					GameObject:
 | 
				
			||||||
 | 
					  m_CorrespondingSourceObject: {fileID: 1107566897619702753, guid: 16d5d75ef61cad14f9aba53761139517, type: 3}
 | 
				
			||||||
 | 
					  m_PrefabInstance: {fileID: 4238491769226202277}
 | 
				
			||||||
 | 
					  m_PrefabAsset: {fileID: 0}
 | 
				
			||||||
 | 
					--- !u!114 &3876120152542236901
 | 
				
			||||||
 | 
					MonoBehaviour:
 | 
				
			||||||
 | 
					  m_ObjectHideFlags: 0
 | 
				
			||||||
 | 
					  m_CorrespondingSourceObject: {fileID: 0}
 | 
				
			||||||
 | 
					  m_PrefabInstance: {fileID: 0}
 | 
				
			||||||
 | 
					  m_PrefabAsset: {fileID: 0}
 | 
				
			||||||
 | 
					  m_GameObject: {fileID: 3858736020799332164}
 | 
				
			||||||
 | 
					  m_Enabled: 1
 | 
				
			||||||
 | 
					  m_EditorHideFlags: 0
 | 
				
			||||||
 | 
					  m_Script: {fileID: 11500000, guid: 5c8db5f2b097c0f4eaa1098c35e1bc0e, type: 3}
 | 
				
			||||||
 | 
					  m_Name: 
 | 
				
			||||||
 | 
					  m_EditorClassIdentifier: 
 | 
				
			||||||
--- !u!1001 &5352609509542677726
 | 
					--- !u!1001 &5352609509542677726
 | 
				
			||||||
PrefabInstance:
 | 
					PrefabInstance:
 | 
				
			||||||
  m_ObjectHideFlags: 0
 | 
					  m_ObjectHideFlags: 0
 | 
				
			||||||
@@ -452,6 +469,34 @@ PrefabInstance:
 | 
				
			|||||||
      propertyPath: m_LocalEulerAnglesHint.z
 | 
					      propertyPath: m_LocalEulerAnglesHint.z
 | 
				
			||||||
      value: 0
 | 
					      value: 0
 | 
				
			||||||
      objectReference: {fileID: 0}
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size
 | 
				
			||||||
 | 
					      value: 1
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Mode
 | 
				
			||||||
 | 
					      value: 1
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
 | 
				
			||||||
 | 
					      value: 
 | 
				
			||||||
 | 
					      objectReference: {fileID: 3876120152542236901}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_CallState
 | 
				
			||||||
 | 
					      value: 2
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
 | 
				
			||||||
 | 
					      value: MainMenu
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName
 | 
				
			||||||
 | 
					      value: UI.PauseMenu, Assembly-CSharp
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName
 | 
				
			||||||
 | 
					      value: UnityEngine.Object, UnityEngine
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
    - target: {fileID: 8836694927704227170, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
					    - target: {fileID: 8836694927704227170, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
      propertyPath: m_text
 | 
					      propertyPath: m_text
 | 
				
			||||||
      value: Main Menu
 | 
					      value: Main Menu
 | 
				
			||||||
@@ -562,6 +607,34 @@ PrefabInstance:
 | 
				
			|||||||
      propertyPath: m_LocalEulerAnglesHint.z
 | 
					      propertyPath: m_LocalEulerAnglesHint.z
 | 
				
			||||||
      value: 0
 | 
					      value: 0
 | 
				
			||||||
      objectReference: {fileID: 0}
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size
 | 
				
			||||||
 | 
					      value: 1
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Mode
 | 
				
			||||||
 | 
					      value: 1
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
 | 
				
			||||||
 | 
					      value: 
 | 
				
			||||||
 | 
					      objectReference: {fileID: 3876120152542236901}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_CallState
 | 
				
			||||||
 | 
					      value: 2
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
 | 
				
			||||||
 | 
					      value: Exit
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName
 | 
				
			||||||
 | 
					      value: UI.PauseMenu, Assembly-CSharp
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName
 | 
				
			||||||
 | 
					      value: UnityEngine.Object, UnityEngine
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
    - target: {fileID: 8836694927704227170, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
					    - target: {fileID: 8836694927704227170, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
      propertyPath: m_text
 | 
					      propertyPath: m_text
 | 
				
			||||||
      value: Exit
 | 
					      value: Exit
 | 
				
			||||||
@@ -672,6 +745,34 @@ PrefabInstance:
 | 
				
			|||||||
      propertyPath: m_LocalEulerAnglesHint.z
 | 
					      propertyPath: m_LocalEulerAnglesHint.z
 | 
				
			||||||
      value: 0
 | 
					      value: 0
 | 
				
			||||||
      objectReference: {fileID: 0}
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size
 | 
				
			||||||
 | 
					      value: 1
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Mode
 | 
				
			||||||
 | 
					      value: 1
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
 | 
				
			||||||
 | 
					      value: 
 | 
				
			||||||
 | 
					      objectReference: {fileID: 3876120152542236901}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_CallState
 | 
				
			||||||
 | 
					      value: 2
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
 | 
				
			||||||
 | 
					      value: Restart
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName
 | 
				
			||||||
 | 
					      value: UI.PauseMenu, Assembly-CSharp
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName
 | 
				
			||||||
 | 
					      value: UnityEngine.Object, UnityEngine
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
    - target: {fileID: 8836694927704227170, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
					    - target: {fileID: 8836694927704227170, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
      propertyPath: m_text
 | 
					      propertyPath: m_text
 | 
				
			||||||
      value: Restart
 | 
					      value: Restart
 | 
				
			||||||
@@ -782,6 +883,34 @@ PrefabInstance:
 | 
				
			|||||||
      propertyPath: m_LocalEulerAnglesHint.z
 | 
					      propertyPath: m_LocalEulerAnglesHint.z
 | 
				
			||||||
      value: 0
 | 
					      value: 0
 | 
				
			||||||
      objectReference: {fileID: 0}
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size
 | 
				
			||||||
 | 
					      value: 1
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Mode
 | 
				
			||||||
 | 
					      value: 1
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
 | 
				
			||||||
 | 
					      value: 
 | 
				
			||||||
 | 
					      objectReference: {fileID: 3876120152542236901}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_CallState
 | 
				
			||||||
 | 
					      value: 2
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
 | 
				
			||||||
 | 
					      value: Resume
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName
 | 
				
			||||||
 | 
					      value: UI.PauseMenu, Assembly-CSharp
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
 | 
					    - target: {fileID: 3806988352586753806, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
 | 
					      propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName
 | 
				
			||||||
 | 
					      value: UnityEngine.Object, UnityEngine
 | 
				
			||||||
 | 
					      objectReference: {fileID: 0}
 | 
				
			||||||
    - target: {fileID: 8836694927704227170, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
					    - target: {fileID: 8836694927704227170, guid: 5c04a1de900c1474c98622e4b3880522, type: 3}
 | 
				
			||||||
      propertyPath: m_text
 | 
					      propertyPath: m_text
 | 
				
			||||||
      value: Resume
 | 
					      value: Resume
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -94,7 +94,7 @@ namespace Level
 | 
				
			|||||||
            UIManager.Instance.CloseAllCanvases();
 | 
					            UIManager.Instance.CloseAllCanvases();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private void DisableAllLevels()
 | 
					        public void DisableAllLevels()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            Player.SetActive(false);
 | 
					            Player.SetActive(false);
 | 
				
			||||||
            foreach (Level level in Levels.Values)
 | 
					            foreach (Level level in Levels.Values)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										40
									
								
								Assets/Scripts/Pausable/Pauser.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								Assets/Scripts/Pausable/Pauser.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
				
			|||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					using Level;
 | 
				
			||||||
 | 
					using UI;
 | 
				
			||||||
 | 
					using UnityEngine;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Pausable
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class Pauser : MonoBehaviour
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        protected Input.PlayerInput playerInput = null;
 | 
				
			||||||
 | 
					        protected bool isPaused = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        protected void Start()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            playerInput = new Input.PlayerInput();
 | 
				
			||||||
 | 
					            playerInput.Enable();
 | 
				
			||||||
 | 
					            playerInput.PlayerControl.Pause.performed += (context) => TogglePause();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public void TogglePause()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (LevelManager.Instance.CurrentLevel == null)
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            isPaused = !isPaused;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (isPaused)
 | 
				
			||||||
 | 
					                UIManager.Instance.SwitchToCanvas("Pause Menu");
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					                UIManager.Instance.CloseAllCanvases();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            foreach (IPausable pausable in FindObjectsOfType<MonoBehaviour>().OfType<IPausable>())
 | 
				
			||||||
 | 
					                if (isPaused)
 | 
				
			||||||
 | 
					                    pausable.Pause();
 | 
				
			||||||
 | 
					                else
 | 
				
			||||||
 | 
					                    pausable.Resume();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										11
									
								
								Assets/Scripts/Pausable/Pauser.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/Pausable/Pauser.cs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					fileFormatVersion: 2
 | 
				
			||||||
 | 
					guid: 1705d06bcf3cabe4d9e2614e86cd0561
 | 
				
			||||||
 | 
					MonoImporter:
 | 
				
			||||||
 | 
					  externalObjects: {}
 | 
				
			||||||
 | 
					  serializedVersion: 2
 | 
				
			||||||
 | 
					  defaultReferences: []
 | 
				
			||||||
 | 
					  executionOrder: 0
 | 
				
			||||||
 | 
					  icon: {instanceID: 0}
 | 
				
			||||||
 | 
					  userData: 
 | 
				
			||||||
 | 
					  assetBundleName: 
 | 
				
			||||||
 | 
					  assetBundleVariant: 
 | 
				
			||||||
@@ -102,6 +102,9 @@ namespace Player
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        private void FixedUpdate()
 | 
					        private void FixedUpdate()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					            if (IsPaused)
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //Took from tutorial : https://www.youtube.com/watch?v=7KiK0Aqtmzc
 | 
					            //Took from tutorial : https://www.youtube.com/watch?v=7KiK0Aqtmzc
 | 
				
			||||||
            switch (_playerRigidbody2D.velocity.y)
 | 
					            switch (_playerRigidbody2D.velocity.y)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
@@ -136,6 +139,9 @@ namespace Player
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        private void Update()
 | 
					        private void Update()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					            if (IsPaused)
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            _isOnAir = !_playerGroundTrigger.IsCollided;
 | 
					            _isOnAir = !_playerGroundTrigger.IsCollided;
 | 
				
			||||||
            RespawnCheck();
 | 
					            RespawnCheck();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -156,13 +162,13 @@ namespace Player
 | 
				
			|||||||
        public void Pause()
 | 
					        public void Pause()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            IsPaused = true;
 | 
					            IsPaused = true;
 | 
				
			||||||
            _playerRigidbody2D.simulated = IsPaused;
 | 
					            _playerRigidbody2D.simulated = !IsPaused;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public void Resume()
 | 
					        public void Resume()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            IsPaused = false;
 | 
					            IsPaused = false;
 | 
				
			||||||
            _playerRigidbody2D.simulated = IsPaused;
 | 
					            _playerRigidbody2D.simulated = !IsPaused;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // MOVE METHODS
 | 
					        // MOVE METHODS
 | 
				
			||||||
@@ -292,5 +298,9 @@ namespace Player
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public void Clop() => clop.PlayClop();
 | 
					        public void Clop() => clop.PlayClop();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public void OnPause(InputAction.CallbackContext context)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										17
									
								
								Assets/Scripts/UI/PauseMenu.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								Assets/Scripts/UI/PauseMenu.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					using Level;
 | 
				
			||||||
 | 
					using UnityEngine;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace UI
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class PauseMenu : MonoBehaviour
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public void Resume() => UIManager.Instance.Pauser.TogglePause();
 | 
				
			||||||
 | 
					        public void Restart() => LevelManager.Instance.CurrentLevel.Restart();
 | 
				
			||||||
 | 
					        public void MainMenu()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            LevelManager.Instance.DisableAllLevels();
 | 
				
			||||||
 | 
					            UIManager.Instance.SwitchToCanvas("Main Menu");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        public void Exit() => Application.Quit();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										11
									
								
								Assets/Scripts/UI/PauseMenu.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/UI/PauseMenu.cs.meta
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					fileFormatVersion: 2
 | 
				
			||||||
 | 
					guid: 5c8db5f2b097c0f4eaa1098c35e1bc0e
 | 
				
			||||||
 | 
					MonoImporter:
 | 
				
			||||||
 | 
					  externalObjects: {}
 | 
				
			||||||
 | 
					  serializedVersion: 2
 | 
				
			||||||
 | 
					  defaultReferences: []
 | 
				
			||||||
 | 
					  executionOrder: 0
 | 
				
			||||||
 | 
					  icon: {instanceID: 0}
 | 
				
			||||||
 | 
					  userData: 
 | 
				
			||||||
 | 
					  assetBundleName: 
 | 
				
			||||||
 | 
					  assetBundleVariant: 
 | 
				
			||||||
@@ -1,4 +1,5 @@
 | 
				
			|||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using Pausable;
 | 
				
			||||||
using UnityEngine;
 | 
					using UnityEngine;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace UI
 | 
					namespace UI
 | 
				
			||||||
@@ -8,6 +9,7 @@ namespace UI
 | 
				
			|||||||
        private static UIManager _instance = null;
 | 
					        private static UIManager _instance = null;
 | 
				
			||||||
        public static UIManager Instance => _instance;
 | 
					        public static UIManager Instance => _instance;
 | 
				
			||||||
        private Dictionary<string, Canvas> canvases = null;
 | 
					        private Dictionary<string, Canvas> canvases = null;
 | 
				
			||||||
 | 
					        public Pauser Pauser { get; private set; } = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private void Awake()
 | 
					        private void Awake()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@@ -18,6 +20,8 @@ namespace UI
 | 
				
			|||||||
                Destroy(this);
 | 
					                Destroy(this);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private void Start() => Pauser = gameObject.AddComponent<Pauser>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public void SwitchToCanvas(string canvasName)
 | 
					        public void SwitchToCanvas(string canvasName)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            Initialize();
 | 
					            Initialize();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user