28 lines
930 B
C#
28 lines
930 B
C#
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
using Valve.VR.InteractionSystem;
|
|
|
|
public class GameOverTextVR : MonoBehaviour {
|
|
public LinearMapping RestartSwitch;
|
|
|
|
private void Start() {
|
|
Transform Anchor = GameObject.FindGameObjectWithTag("Front Of Player Anchor").transform;
|
|
transform.position = Anchor.position;
|
|
transform.rotation = Anchor.rotation;
|
|
}
|
|
|
|
private void Update() {
|
|
if (RestartSwitch.value >= 0.99f) {
|
|
Interactable SwitchInteractable = RestartSwitch.GetComponent<Interactable>();
|
|
if (SwitchInteractable != null) {
|
|
Hand Hand = SwitchInteractable.attachedToHand;
|
|
if (Hand != null) {
|
|
Hand.TriggerHapticPulse(1000);
|
|
}
|
|
Hand.DetachObject(SwitchInteractable.gameObject);
|
|
}
|
|
SceneManager.LoadScene("Scenes/VRScene");
|
|
}
|
|
}
|
|
}
|