TriggerDetector.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  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. if (other.CompareTag("WristLeft"))
  9. {
  10. other.GetComponent<Renderer>().material.color = new Color(1, 1, 1);
  11. other.GetComponent<LineRenderer>().startColor = new Color(1, 1, 1);
  12. BodySourceView bsv = other.GetComponentInParent<BodySourceView>();
  13. bsv.wristLeftLate = false;
  14. Visualizer_FadeIn vfi = GetComponentInParent<Visualizer_FadeIn>();
  15. vfi.wristLeftTriggered = true;
  16. // TODO: Destroy visualization step if it is touched (need to test)
  17. Destroy(gameObject.transform.parent);
  18. } else if (other.CompareTag("WristRight"))
  19. {
  20. other.GetComponent<Renderer>().material.color = new Color(1, 1, 1);
  21. other.GetComponent<LineRenderer>().startColor = 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. Destroy(gameObject.transform.parent);
  27. }
  28. }
  29. }