diff --git a/Assets/PlayerControls.inputactions b/Assets/PlayerControls.inputactions index 1575dd9..566ff87 100644 --- a/Assets/PlayerControls.inputactions +++ b/Assets/PlayerControls.inputactions @@ -59,6 +59,15 @@ "processors": "", "interactions": "", "initialStateCheck": false + }, + { + "name": "Interact", + "type": "Button", + "id": "659c7039-016f-46e9-948a-517daf323bd7", + "expectedControlType": "", + "processors": "", + "interactions": "Tap,Hold", + "initialStateCheck": false } ], "bindings": [ @@ -237,6 +246,28 @@ "action": "Run", "isComposite": false, "isPartOfComposite": false + }, + { + "name": "", + "id": "045d63b8-c118-4d79-a439-5f1fc422a65f", + "path": "/buttonNorth", + "interactions": "", + "processors": "", + "groups": "", + "action": "Interact", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "96d963c4-bd8d-4dd6-a8c7-fa55d8318aa2", + "path": "/f", + "interactions": "", + "processors": "", + "groups": "", + "action": "Interact", + "isComposite": false, + "isPartOfComposite": false } ] } diff --git a/Assets/Scenes/Scene1-1.unity b/Assets/Scenes/Scene1-1.unity index 552b1c8..e3bebd1 100644 --- a/Assets/Scenes/Scene1-1.unity +++ b/Assets/Scenes/Scene1-1.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1dbf24dfea5f4599236fa1780038f51e680055aa831deead404ce9c875ec5a36 -size 1418600 +oid sha256:0852b2998956f1c7a68a9944836ca80674cef5f3208370ad5a56c2ca3490ca8a +size 1482634 diff --git a/Assets/Scripts/MouthOpenClose.cs b/Assets/Scripts/MouthOpenClose.cs index b0ccf06..38f4881 100644 --- a/Assets/Scripts/MouthOpenClose.cs +++ b/Assets/Scripts/MouthOpenClose.cs @@ -1,5 +1,7 @@ using TMPro; using UnityEngine; +using UnityEngine.InputSystem; +using UnityEngine.InputSystem.Interactions; public class MouthOpenClose : MonoBehaviour { @@ -59,11 +61,11 @@ public class MouthOpenClose : MonoBehaviour prompt.SetActive(true); if (Input.GetKeyDown(KeyCode.E)) { - interacted = true; - prompt.SetActive(false); - text.SetActive(true); - text.GetComponent().text = whatToSay; - timerDeactivate = initialTimerDeactivate; + //interacted = true; + //prompt.SetActive(false); + //text.SetActive(true); + //text.GetComponent().text = whatToSay; + //timerDeactivate = initialTimerDeactivate; } } else @@ -120,10 +122,27 @@ public class MouthOpenClose : MonoBehaviour if (text.GetComponent().text != whatToSay) interacted = false; if (Input.GetKeyDown(KeyCode.C)) + { + //text.SetActive(false); + //interacted = false; + } + } + public void OnInteract(InputAction.CallbackContext context) + { + if (context.performed && !interacted && Vector3.Distance(transform.position, player.transform.position) < 3 && context.interaction is TapInteraction) + { + interacted = true; + prompt.SetActive(false); + text.SetActive(true); + text.GetComponent().text = whatToSay; + timerDeactivate = initialTimerDeactivate; + } + if (context.performed && context.interaction is HoldInteraction) { text.SetActive(false); interacted = false; } + } }