2020-06-12 21:28:40 +02:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.SceneManagement;
|
|
|
|
|
using Valve.VR.InteractionSystem;
|
2020-06-11 23:10:30 +02:00
|
|
|
|
|
|
|
|
|
public class GameOverTextVR : MonoBehaviour {
|
2020-06-12 21:28:40 +02:00
|
|
|
|
public LinearMapping RestartSwitch;
|
2020-06-11 23:10:30 +02:00
|
|
|
|
|
|
|
|
|
private void Start() {
|
2020-06-12 21:28:40 +02:00
|
|
|
|
Transform Anchor = GameObject.FindGameObjectWithTag("Front Of Player Anchor").transform;
|
2020-06-11 23:10:30 +02:00
|
|
|
|
transform.position = Anchor.position;
|
|
|
|
|
transform.rotation = Anchor.rotation;
|
|
|
|
|
}
|
2020-06-12 21:28:40 +02:00
|
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-06-11 23:10:30 +02:00
|
|
|
|
}
|