move more stuff over to unity input system
This commit is contained in:
@@ -59,6 +59,15 @@
|
|||||||
"processors": "",
|
"processors": "",
|
||||||
"interactions": "",
|
"interactions": "",
|
||||||
"initialStateCheck": false
|
"initialStateCheck": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Interact",
|
||||||
|
"type": "Button",
|
||||||
|
"id": "659c7039-016f-46e9-948a-517daf323bd7",
|
||||||
|
"expectedControlType": "",
|
||||||
|
"processors": "",
|
||||||
|
"interactions": "Tap,Hold",
|
||||||
|
"initialStateCheck": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"bindings": [
|
"bindings": [
|
||||||
@@ -237,6 +246,28 @@
|
|||||||
"action": "Run",
|
"action": "Run",
|
||||||
"isComposite": false,
|
"isComposite": false,
|
||||||
"isPartOfComposite": false
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "045d63b8-c118-4d79-a439-5f1fc422a65f",
|
||||||
|
"path": "<Gamepad>/buttonNorth",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Interact",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "96d963c4-bd8d-4dd6-a8c7-fa55d8318aa2",
|
||||||
|
"path": "<Keyboard>/f",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Interact",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
Assets/Scenes/Scene1-1.unity
LFS
BIN
Assets/Scenes/Scene1-1.unity
LFS
Binary file not shown.
@@ -1,5 +1,7 @@
|
|||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.InputSystem;
|
||||||
|
using UnityEngine.InputSystem.Interactions;
|
||||||
|
|
||||||
public class MouthOpenClose : MonoBehaviour
|
public class MouthOpenClose : MonoBehaviour
|
||||||
{
|
{
|
||||||
@@ -59,11 +61,11 @@ public class MouthOpenClose : MonoBehaviour
|
|||||||
prompt.SetActive(true);
|
prompt.SetActive(true);
|
||||||
if (Input.GetKeyDown(KeyCode.E))
|
if (Input.GetKeyDown(KeyCode.E))
|
||||||
{
|
{
|
||||||
interacted = true;
|
//interacted = true;
|
||||||
prompt.SetActive(false);
|
//prompt.SetActive(false);
|
||||||
text.SetActive(true);
|
//text.SetActive(true);
|
||||||
text.GetComponent<TextMeshProUGUI>().text = whatToSay;
|
//text.GetComponent<TextMeshProUGUI>().text = whatToSay;
|
||||||
timerDeactivate = initialTimerDeactivate;
|
//timerDeactivate = initialTimerDeactivate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -120,10 +122,27 @@ public class MouthOpenClose : MonoBehaviour
|
|||||||
if (text.GetComponent<TextMeshProUGUI>().text != whatToSay) interacted = false;
|
if (text.GetComponent<TextMeshProUGUI>().text != whatToSay) interacted = false;
|
||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.C))
|
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<TextMeshProUGUI>().text = whatToSay;
|
||||||
|
timerDeactivate = initialTimerDeactivate;
|
||||||
|
}
|
||||||
|
if (context.performed && context.interaction is HoldInteraction)
|
||||||
{
|
{
|
||||||
text.SetActive(false);
|
text.SetActive(false);
|
||||||
interacted = false;
|
interacted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user