Newer
Older
Dreamsturbia-Project-IADE-Unity3D / Assets / PressurePlate2.cs
@Rackday Rackday on 21 Aug 776 bytes Project Added
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class PressurePlate2 : MonoBehaviour
  5. {
  6. [SerializeField] private List<string> acceptedTags;
  7. private bool canRayCast = true;
  8. private Triggers triggers;
  9. // Start is called before the first frame update
  10. void Start()
  11. {
  12. triggers = transform.parent.GetComponent<Triggers>();
  13. }
  14. // Update is called once per frame
  15. private void OnTriggerEnter(Collider other)
  16. {
  17. foreach (string s in acceptedTags)
  18. {
  19. if (other.gameObject.CompareTag(s))
  20. {
  21. triggers.CheckInverse(true);
  22. }
  23. }
  24. }
  25. private void OnTriggerExit(Collider other)
  26. {
  27. triggers.CheckInverse(false);
  28. }
  29. }