-
Notifications
You must be signed in to change notification settings - Fork 2
/
HeadsetAdjustment.cs
44 lines (37 loc) · 1.18 KB
/
HeadsetAdjustment.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using UnityEngine;
using UnityEngine.SceneManagement;
using HoloToolkit.Unity.InputModule;
namespace HoloToolkit.Unity
{
public class HeadsetAdjustment : MonoBehaviour, IInputClickHandler, ISpeechHandler
{
public string NextSceneName;
private void Start()
{
InputManager.Instance.AddGlobalListener(gameObject);
}
public void OnInputClicked(InputClickedEventData eventData)
{
GotoNextScene();
}
public void OnSpeechKeywordRecognized(SpeechEventData eventData)
{
GotoNextScene();
}
private void GotoNextScene()
{
InputManager.Instance.RemoveGlobalListener(gameObject);
if (!string.IsNullOrEmpty(NextSceneName))
{
SceneManager.LoadScene(NextSceneName);
}
else
{
int sceneIndex = SceneManager.GetActiveScene().buildIndex;
SceneManager.LoadScene(sceneIndex + 1);
}
}
}
}