93 lines
2.2 KiB
C#
93 lines
2.2 KiB
C#
using System.Collections;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class StartMenu : MonoBehaviour
|
|
{
|
|
public OVROverlay overlay;
|
|
|
|
public OVROverlay text;
|
|
|
|
public OVRCameraRig vrRig;
|
|
|
|
private void Start()
|
|
{
|
|
DebugUIBuilder.instance.AddLabel("Select Sample Scene");
|
|
DebugUIBuilder.instance.AddButton("Avatar Grab", LoadAvatarGrab);
|
|
DebugUIBuilder.instance.AddButton("Custom Controllers", LoadCustomControllers);
|
|
DebugUIBuilder.instance.AddButton("Custom Hands", LoadCustomHands);
|
|
DebugUIBuilder.instance.AddButton("Debug UI", LoadDebugUI);
|
|
DebugUIBuilder.instance.AddButton("Distance Grab", LoadDistanceGrab);
|
|
DebugUIBuilder.instance.AddButton("Guardian Boundary System", LoadGuardianBoundarySystem);
|
|
DebugUIBuilder.instance.AddButton("Locomotion", LoadLocomotion);
|
|
DebugUIBuilder.instance.AddButton("Mixed Reality Capture", LoadMixedRealityCapture);
|
|
DebugUIBuilder.instance.AddButton("OVR Overlay", LoadOVROverlay);
|
|
DebugUIBuilder.instance.Show();
|
|
}
|
|
|
|
private void LoadScene(string sceneName)
|
|
{
|
|
DebugUIBuilder.instance.Hide();
|
|
StartCoroutine(ShowOverlayAndLoad(sceneName));
|
|
}
|
|
|
|
private IEnumerator ShowOverlayAndLoad(string sceneName)
|
|
{
|
|
text.transform.position = vrRig.centerEyeAnchor.position + Vector3.ProjectOnPlane(vrRig.centerEyeAnchor.forward, Vector3.up).normalized * 3f;
|
|
overlay.enabled = true;
|
|
text.enabled = true;
|
|
yield return new WaitForSeconds(1f);
|
|
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneName);
|
|
while (!asyncLoad.isDone)
|
|
{
|
|
yield return null;
|
|
}
|
|
yield return null;
|
|
}
|
|
|
|
private void LoadAvatarGrab()
|
|
{
|
|
LoadScene("AvatarGrab");
|
|
}
|
|
|
|
private void LoadCustomControllers()
|
|
{
|
|
LoadScene("CustomControllers");
|
|
}
|
|
|
|
private void LoadCustomHands()
|
|
{
|
|
LoadScene("CustomHands");
|
|
}
|
|
|
|
private void LoadDebugUI()
|
|
{
|
|
LoadScene("DebugUI");
|
|
}
|
|
|
|
private void LoadDistanceGrab()
|
|
{
|
|
LoadScene("DistanceGrab");
|
|
}
|
|
|
|
private void LoadGuardianBoundarySystem()
|
|
{
|
|
LoadScene("GuardianBoundarySystem");
|
|
}
|
|
|
|
private void LoadLocomotion()
|
|
{
|
|
LoadScene("Locomotion");
|
|
}
|
|
|
|
private void LoadMixedRealityCapture()
|
|
{
|
|
LoadScene("MixedRealityCapture");
|
|
}
|
|
|
|
private void LoadOVROverlay()
|
|
{
|
|
LoadScene("OVROverlay");
|
|
}
|
|
}
|