diff --git a/Tenebrissilva/Assets/_Project/InputMaster/PlayerInput.inputactions b/Tenebrissilva/Assets/_Project/InputMaster/PlayerInput.inputactions index 9d456ad9423af6e08ff27bc78825a5a3c09df64c..99cc32f2a5ad779d4dd4acf0abaf281743b62673 100644 --- a/Tenebrissilva/Assets/_Project/InputMaster/PlayerInput.inputactions +++ b/Tenebrissilva/Assets/_Project/InputMaster/PlayerInput.inputactions @@ -206,6 +206,14 @@ "expectedControlType": "Button", "processors": "", "interactions": "" + }, + { + "name": "Inventory", + "type": "Button", + "id": "5e1b85a5-0daf-4c4b-9f7d-de4153a353f0", + "expectedControlType": "Button", + "processors": "", + "interactions": "" } ], "bindings": [ @@ -219,6 +227,17 @@ "action": "Pause", "isComposite": false, "isPartOfComposite": false + }, + { + "name": "", + "id": "38af1828-af7d-4c1c-99a1-fa2b52dfd480", + "path": "<Keyboard>/q", + "interactions": "", + "processors": "", + "groups": "Keyboard_and_Mouse", + "action": "Inventory", + "isComposite": false, + "isPartOfComposite": false } ] } diff --git a/Tenebrissilva/Assets/_Project/Scenes/DarkWorld.unity b/Tenebrissilva/Assets/_Project/Scenes/DarkWorld.unity index 4ebb1e4c98fb00078c6e30f517d3666c11f70e2f..4d35e5c8c379f15e50e3a2572eefdf7281ddb535 100644 --- a/Tenebrissilva/Assets/_Project/Scenes/DarkWorld.unity +++ b/Tenebrissilva/Assets/_Project/Scenes/DarkWorld.unity @@ -2021,7 +2021,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!114 &392600265 MonoBehaviour: m_ObjectHideFlags: 0 @@ -589019,7 +589019,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 436051917072463245, guid: c7ecd9a53a82241648f1adb8b1053bea, type: 3} propertyPath: m_LocalRotation.x - value: -0.000000030733645 + value: -0.000000031199306 objectReference: {fileID: 0} - target: {fileID: 436051917072463245, guid: c7ecd9a53a82241648f1adb8b1053bea, type: 3} propertyPath: m_LocalRotation.y @@ -589027,7 +589027,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 436051917072463245, guid: c7ecd9a53a82241648f1adb8b1053bea, type: 3} propertyPath: m_LocalRotation.z - value: -0 + value: 0.0000000018626451 objectReference: {fileID: 0} - target: {fileID: 436051917409917358, guid: c7ecd9a53a82241648f1adb8b1053bea, type: 3} propertyPath: m_FollowOffset.y @@ -589063,7 +589063,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 436051918106086459, guid: c7ecd9a53a82241648f1adb8b1053bea, type: 3} propertyPath: m_LocalRotation.z - value: -0.000000011175871 + value: -0.000000009313226 objectReference: {fileID: 0} - target: {fileID: 436051918175182101, guid: c7ecd9a53a82241648f1adb8b1053bea, type: 3} propertyPath: m_LocalPosition.x @@ -589167,7 +589167,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 436051918733258004, guid: c7ecd9a53a82241648f1adb8b1053bea, type: 3} propertyPath: m_LocalRotation.x - value: -0.000000030733645 + value: -0.000000031199306 objectReference: {fileID: 0} - target: {fileID: 436051918733258004, guid: c7ecd9a53a82241648f1adb8b1053bea, type: 3} propertyPath: m_LocalRotation.y @@ -589175,7 +589175,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 436051918733258004, guid: c7ecd9a53a82241648f1adb8b1053bea, type: 3} propertyPath: m_LocalRotation.z - value: -0 + value: 0.0000000018626451 objectReference: {fileID: 0} - target: {fileID: 436051918835300137, guid: c7ecd9a53a82241648f1adb8b1053bea, type: 3} propertyPath: m_FollowOffset.y diff --git a/Tenebrissilva/Assets/_Project/Scripts/GameMaster.cs b/Tenebrissilva/Assets/_Project/Scripts/GameMaster.cs new file mode 100644 index 0000000000000000000000000000000000000000..76a9ecd36f4e287ff6b2821e97b9bf9801f212f1 --- /dev/null +++ b/Tenebrissilva/Assets/_Project/Scripts/GameMaster.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class GameMaster : MonoBehaviour +{ + public static PlayerInput input; + static var PlayerInput iinput; + var int startingHealth = 100; + + private void Awake() + { + input = new PlayerInput(); + } +} diff --git a/Tenebrissilva/Assets/_Project/Scripts/GameMaster.cs.meta b/Tenebrissilva/Assets/_Project/Scripts/GameMaster.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..4489131f4c5b41866b7867f4eb45177b53eb3c2c --- /dev/null +++ b/Tenebrissilva/Assets/_Project/Scripts/GameMaster.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1f26f4ba4f50241918f0e56e087fe84e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Tenebrissilva/Assets/_Project/Scripts/Player/PlayerInput.cs b/Tenebrissilva/Assets/_Project/Scripts/Player/PlayerInput.cs index 0c48d814295e2cbe01863421260be8a807a6ef50..68a40e0040b4f6e3da6db005ea43f8d71b92cd47 100644 --- a/Tenebrissilva/Assets/_Project/Scripts/Player/PlayerInput.cs +++ b/Tenebrissilva/Assets/_Project/Scripts/Player/PlayerInput.cs @@ -219,6 +219,14 @@ public class @PlayerInput : IInputActionCollection, IDisposable ""expectedControlType"": ""Button"", ""processors"": """", ""interactions"": """" + }, + { + ""name"": ""Inventory"", + ""type"": ""Button"", + ""id"": ""5e1b85a5-0daf-4c4b-9f7d-de4153a353f0"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """" } ], ""bindings"": [ @@ -232,6 +240,17 @@ public class @PlayerInput : IInputActionCollection, IDisposable ""action"": ""Pause"", ""isComposite"": false, ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""38af1828-af7d-4c1c-99a1-fa2b52dfd480"", + ""path"": ""<Keyboard>/q"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Keyboard_and_Mouse"", + ""action"": ""Inventory"", + ""isComposite"": false, + ""isPartOfComposite"": false } ] } @@ -275,6 +294,7 @@ public class @PlayerInput : IInputActionCollection, IDisposable // UI m_UI = asset.FindActionMap("UI", throwIfNotFound: true); m_UI_Pause = m_UI.FindAction("Pause", throwIfNotFound: true); + m_UI_Inventory = m_UI.FindAction("Inventory", throwIfNotFound: true); } public void Dispose() @@ -382,11 +402,13 @@ public class @PlayerInput : IInputActionCollection, IDisposable private readonly InputActionMap m_UI; private IUIActions m_UIActionsCallbackInterface; private readonly InputAction m_UI_Pause; + private readonly InputAction m_UI_Inventory; public struct UIActions { private @PlayerInput m_Wrapper; public UIActions(@PlayerInput wrapper) { m_Wrapper = wrapper; } public InputAction @Pause => m_Wrapper.m_UI_Pause; + public InputAction @Inventory => m_Wrapper.m_UI_Inventory; public InputActionMap Get() { return m_Wrapper.m_UI; } public void Enable() { Get().Enable(); } public void Disable() { Get().Disable(); } @@ -399,6 +421,9 @@ public class @PlayerInput : IInputActionCollection, IDisposable @Pause.started -= m_Wrapper.m_UIActionsCallbackInterface.OnPause; @Pause.performed -= m_Wrapper.m_UIActionsCallbackInterface.OnPause; @Pause.canceled -= m_Wrapper.m_UIActionsCallbackInterface.OnPause; + @Inventory.started -= m_Wrapper.m_UIActionsCallbackInterface.OnInventory; + @Inventory.performed -= m_Wrapper.m_UIActionsCallbackInterface.OnInventory; + @Inventory.canceled -= m_Wrapper.m_UIActionsCallbackInterface.OnInventory; } m_Wrapper.m_UIActionsCallbackInterface = instance; if (instance != null) @@ -406,6 +431,9 @@ public class @PlayerInput : IInputActionCollection, IDisposable @Pause.started += instance.OnPause; @Pause.performed += instance.OnPause; @Pause.canceled += instance.OnPause; + @Inventory.started += instance.OnInventory; + @Inventory.performed += instance.OnInventory; + @Inventory.canceled += instance.OnInventory; } } } @@ -438,5 +466,6 @@ public class @PlayerInput : IInputActionCollection, IDisposable public interface IUIActions { void OnPause(InputAction.CallbackContext context); + void OnInventory(InputAction.CallbackContext context); } } diff --git a/Tenebrissilva/Assets/_Project/Scripts/Player/PlayerMovement.cs b/Tenebrissilva/Assets/_Project/Scripts/Player/PlayerMovement.cs index 36b5d0fbf3cfddcb10f2e007d4b3dceae9d19f26..192d3a8cfc843fa40d2be609934a99585b447d14 100644 --- a/Tenebrissilva/Assets/_Project/Scripts/Player/PlayerMovement.cs +++ b/Tenebrissilva/Assets/_Project/Scripts/Player/PlayerMovement.cs @@ -1,6 +1,4 @@ using System; -using System.Collections; -using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem; @@ -25,8 +23,9 @@ public class PlayerMovement : MonoBehaviour private void Awake() { + input = GameMaster.input; + move = input.Player.Movement; rb = this.GetComponent<Rigidbody>(); - input = new PlayerInput(); animator = this.GetComponent<Animator>(); } @@ -34,7 +33,7 @@ public class PlayerMovement : MonoBehaviour { input.Player.Jump.started += DoJump; input.Player.Attack.started += DoAttack; - move = input.Player.Movement; + //move = input.Player.Movement; input.Player.Enable(); } diff --git a/Tenebrissilva/Assets/_Project/Scripts/UI/PauseMenu.cs b/Tenebrissilva/Assets/_Project/Scripts/UI/PauseMenu.cs index ce8a723a7f8442e0db1d27f3df0a149bce50b1d1..1886f3ee41298d8d5d7da4332db7471b24786b7f 100644 --- a/Tenebrissilva/Assets/_Project/Scripts/UI/PauseMenu.cs +++ b/Tenebrissilva/Assets/_Project/Scripts/UI/PauseMenu.cs @@ -2,18 +2,28 @@ using System; using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.InputSystem; public class PauseMenu : MonoBehaviour { - + private PlayerInput input; + private InputAction pushed; + public static bool GameIsStopped = false; public GameObject menuUI; //private PlayerMovement playerMovement; + private void Awake() + { + input = GameMaster.input; + pushed = input.UI.Pause; + } + + private void Update() { - if (Input.GetKeyDown(KeyCode.Escape)) + if (pushed.triggered) { if (GameIsStopped) {