Interhaptics SDK for Unity 1.6
Loading...
Searching...
No Matches
AudioControlGUI.cs
Go to the documentation of this file.
1/* ​
2* Copyright (c) 2023 Go Touch VR SAS. All rights reserved. ​
3* ​
4*/
5
6using UnityEngine;
8
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}
override void PlayEventVibration()
Method to start the coroutine from outside (if necessary). Plays the haptic effect after the vibratio...