TriggerDetector.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class TriggerDetector : MonoBehaviour
  5. {
  6. private void OnTriggerEnter(Collider other)
  7. {
  8. // TODO: need to test
  9. if (other.CompareTag("WristLeft"))
  10. {
  11. Debug.Log("WristLeft triggered");
  12. other.GetComponent<Renderer>().material.color = new Color(1, 1, 1);
  13. BodySourceView bsv = other.GetComponentInParent<BodySourceView>();
  14. bsv.wristLeftLate = false;
  15. Visualizer_FadeIn vfi = GetComponentInParent<Visualizer_FadeIn>();
  16. vfi.wristLeftTriggered = true;
  17. }
  18. if (other.CompareTag("WristRight"))
  19. {
  20. Debug.Log("WristRight triggered");
  21. other.GetComponent<Renderer>().material.color = new Color(1, 1, 1);
  22. BodySourceView bsv = other.GetComponentInParent<BodySourceView>();
  23. bsv.wristRightLate = false;
  24. Visualizer_FadeIn vfi = GetComponentInParent<Visualizer_FadeIn>();
  25. vfi.wristRightTriggered = true;
  26. }
  27. }
  28. }