fr.jeanf.universal.player 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
using jeanf.EventSystem;
|
|
2
2
|
using UnityEngine;
|
|
3
|
-
using UnityEngine.XR.Interaction.Toolkit;
|
|
4
3
|
using UnityEngine.XR.Interaction.Toolkit.Inputs.Haptics;
|
|
5
4
|
public class HandVibration : MonoBehaviour
|
|
6
5
|
{
|
|
@@ -11,14 +10,19 @@ public class HandVibration : MonoBehaviour
|
|
|
11
10
|
|
|
12
11
|
[Header("Listening On")]
|
|
13
12
|
[SerializeField] StringEventChannelSO hapticFeedbackOnSpecificHandSO;
|
|
13
|
+
public delegate void VibrateHandDelegate(string hand, float amplitude, float duration);
|
|
14
|
+
|
|
15
|
+
public VibrateHandDelegate VibrateHand;
|
|
14
16
|
private void OnEnable()
|
|
15
17
|
{
|
|
16
18
|
hapticFeedbackOnSpecificHandSO.OnEventRaised += TriggerHapticFeedback;
|
|
19
|
+
VibrateHand += TriggerHapticFeedback;
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
private void OnDisable()
|
|
20
23
|
{
|
|
21
24
|
hapticFeedbackOnSpecificHandSO.OnEventRaised += TriggerHapticFeedback;
|
|
25
|
+
VibrateHand -= TriggerHapticFeedback;
|
|
22
26
|
}
|
|
23
27
|
private void TriggerHapticFeedback(string hand)
|
|
24
28
|
{
|
|
@@ -32,4 +36,28 @@ public class HandVibration : MonoBehaviour
|
|
|
32
36
|
break;
|
|
33
37
|
}
|
|
34
38
|
}
|
|
39
|
+
private void TriggerHapticFeedback(string hand, float duration)
|
|
40
|
+
{
|
|
41
|
+
switch (hand)
|
|
42
|
+
{
|
|
43
|
+
case "Right":
|
|
44
|
+
rightHandHapticImpulse.SendHapticImpulse(amplitude, duration);
|
|
45
|
+
break;
|
|
46
|
+
case "Left":
|
|
47
|
+
leftHandHapticImpulse.SendHapticImpulse(amplitude, duration);
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
private void TriggerHapticFeedback(string hand, float amplitude, float duration)
|
|
52
|
+
{
|
|
53
|
+
switch (hand)
|
|
54
|
+
{
|
|
55
|
+
case "Right":
|
|
56
|
+
rightHandHapticImpulse.SendHapticImpulse(amplitude, duration);
|
|
57
|
+
break;
|
|
58
|
+
case "Left":
|
|
59
|
+
leftHandHapticImpulse.SendHapticImpulse(amplitude, duration);
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
35
63
|
}
|