move more stuff over to unity input system
This commit is contained in:
@@ -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<TextMeshProUGUI>().text = whatToSay;
|
||||
timerDeactivate = initialTimerDeactivate;
|
||||
//interacted = true;
|
||||
//prompt.SetActive(false);
|
||||
//text.SetActive(true);
|
||||
//text.GetComponent<TextMeshProUGUI>().text = whatToSay;
|
||||
//timerDeactivate = initialTimerDeactivate;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -120,10 +122,27 @@ public class MouthOpenClose : MonoBehaviour
|
||||
if (text.GetComponent<TextMeshProUGUI>().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<TextMeshProUGUI>().text = whatToSay;
|
||||
timerDeactivate = initialTimerDeactivate;
|
||||
}
|
||||
if (context.performed && context.interaction is HoldInteraction)
|
||||
{
|
||||
text.SetActive(false);
|
||||
interacted = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user