campfire/Assets/Scripts/GameOverTextVR.cs

28 lines
930 B
C#
Raw Permalink Normal View History

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