Interhaptics SDK for Unity
1.6
Loading...
Searching...
No Matches
Interhaptics
sdk_unity
Interhaptics
Runtime
Samples
HapticControlGUI.cs
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2023 Go Touch VR SAS. All rights reserved.
3
*
4
*/
5
6
using
UnityEngine;
7
using
Interhaptics.Utils
;
8
9
namespace
Interhaptics.Samples
10
{
11
public
class
HapticControlGUI
: MonoBehaviour
12
{
13
[SerializeField]
14
private
EventHapticManagerMobile
eventHapticManagerMobile;
15
[SerializeField]
16
private
EventHapticSource
eventHapticSource;
17
[SerializeField]
18
private
GameObject buttonPlay;
19
[SerializeField]
20
private
GameObject buttonStop;
21
22
void
Start()
23
{
24
buttonPlay.SetActive(
true
);
25
buttonStop.SetActive(
false
);
26
}
27
28
public
void
StartHaptics
()
29
{
30
eventHapticManagerMobile.
StopPlayingEventHapticSources
();
31
eventHapticSource.
PlayEventVibration
();
32
}
33
public
void
StopHaptics
()
34
{
35
eventHapticSource.
Stop
();
36
Interhaptics
.
Core
.
HAR
.ClearActiveEvents();
37
}
38
39
void
Update()
40
{
41
if
(eventHapticSource ==
null
)
return
;
42
if
(eventHapticSource.
isPlaying
)
43
{
44
buttonPlay.SetActive(
false
);
45
buttonStop.SetActive(
true
);
46
}
47
else
48
{
49
buttonPlay.SetActive(
true
);
50
buttonStop.SetActive(
false
);
51
}
52
}
53
}
54
55
}
Interhaptics.Core.HAR
Definition
HAR.Native.cs:12
Interhaptics.Internal.HapticSource.isPlaying
bool isPlaying
Definition
HapticSource.cs:54
Interhaptics.Samples.EventHapticManagerMobile
Definition
EventHapticManagerMobile.cs:13
Interhaptics.Samples.EventHapticManagerMobile.StopPlayingEventHapticSources
void StopPlayingEventHapticSources()
Definition
EventHapticManagerMobile.cs:17
Interhaptics.Samples.HapticControlGUI
Definition
HapticControlGUI.cs:12
Interhaptics.Samples.HapticControlGUI.StartHaptics
void StartHaptics()
Definition
HapticControlGUI.cs:28
Interhaptics.Samples.HapticControlGUI.StopHaptics
void StopHaptics()
Definition
HapticControlGUI.cs:33
Interhaptics.Utils.EventHapticSource
Haptic source that plays a haptic effect when triggered by an event. Plays the haptic effect on the s...
Definition
EventHapticSource.cs:20
Interhaptics.Utils.EventHapticSource.Stop
override void Stop()
Stops the haptic effect on the specified body parts.
Definition
EventHapticSource.cs:49
Interhaptics.Utils.EventHapticSource.PlayEventVibration
override void PlayEventVibration()
Method to start the coroutine from outside (if necessary). Plays the haptic effect after the vibratio...
Definition
EventHapticSource.cs:58
Interhaptics.Core
Definition
MobileControl.cs:12
Interhaptics.Samples
Definition
AudioControlGUI.cs:10
Interhaptics.Utils
Definition
ConditionalHideAttribute.cs:7
Interhaptics
Definition
ConditionalHideAttribute.cs:7
Generated by
1.11.0