Tanoda
HeartBeatManager.cs
Go to the documentation of this file.
1using System.Collections;
2using System.Collections.Generic;
3using UnityEngine;
4using Valve.VR.InteractionSystem;
5
6public class HeartBeatManager : MonoBehaviour
7{
8 public GameObject head, rightHand, leftHand;
9 public float distance;
10 // Start is called before the first frame update
11 void Start()
12 {
13
14 }
15
16 // Update is called once per frame
17 void Update()
18 {
19 var DistanceRight = head.transform.position.y - rightHand.transform.position.y;
20 var DistanceLeft = head.transform.position.y - leftHand.transform.position.y;
21 if ((DistanceLeft < distance && leftHand.activeInHierarchy)|| (DistanceRight < distance && rightHand.activeInHierarchy))
22 transform.GetChild(0).gameObject.SetActive(true);
23 else
24 transform.GetChild(0).gameObject.SetActive(false);
25
26
27 }
28}
GameObject leftHand
GameObject rightHand