Interhaptics SDK for Unity
1.6
Loading...
Searching...
No Matches
Interhaptics
sdk_unity
Interhaptics
Runtime
Samples
AudioControlGUI.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
AudioControlGUI
: MonoBehaviour
12
{
13
[SerializeField]
14
private
AudioHapticSource
audioHapticSource;
15
[SerializeField]
16
AudioManagerMobile
audioManagerMobile;
17
[SerializeField]
18
private
GameObject buttonPlay;
19
[SerializeField]
20
private
GameObject buttonStop;
21
22
// Start is called before the first frame update
23
private
void
Start()
24
{
25
buttonPlay.SetActive(
true
);
26
buttonStop.SetActive(
false
);
27
}
28
29
public
void
StartHaptics
()
30
{
31
audioManagerMobile.
StopPlayingAudioHapticSources
();
32
Interhaptics
.
Core
.
HAR
.ClearActiveEvents();
33
audioHapticSource.
PlayEventVibration
();
34
}
35
36
public
void
StopHaptics
()
37
{
38
audioHapticSource.
audioSource
.Stop();
39
Interhaptics
.
Core
.
HAR
.ClearActiveEvents();
40
}
41
42
// Update is called once per frame
43
private
void
Update()
44
{
45
if
(audioHapticSource.
audioSource
.isPlaying)
46
{
47
buttonPlay.SetActive(
false
);
48
buttonStop.SetActive(
true
);
49
}
50
else
51
{
52
buttonPlay.SetActive(
true
);
53
buttonStop.SetActive(
false
);
54
}
55
}
56
}
57
}
Interhaptics.Core.HAR
Definition
HAR.Native.cs:12
Interhaptics.Samples.AudioControlGUI
Definition
AudioControlGUI.cs:12
Interhaptics.Samples.AudioControlGUI.StopHaptics
void StopHaptics()
Definition
AudioControlGUI.cs:36
Interhaptics.Samples.AudioControlGUI.StartHaptics
void StartHaptics()
Definition
AudioControlGUI.cs:29
Interhaptics.Samples.AudioManagerMobile
Definition
AudioManagerMobile.cs:13
Interhaptics.Samples.AudioManagerMobile.StopPlayingAudioHapticSources
void StopPlayingAudioHapticSources()
Definition
AudioManagerMobile.cs:17
Interhaptics.Utils.AudioHapticSource
Definition
AudioHapticSource.cs:18
Interhaptics.Utils.AudioHapticSource.PlayEventVibration
override void PlayEventVibration()
Method to start the coroutine from outside (if necessary). Plays the haptic effect after the vibratio...
Definition
AudioHapticSource.cs:73
Interhaptics.Utils.AudioHapticSource.audioSource
AudioSource audioSource
Definition
AudioHapticSource.cs:21
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