DoorTrigger.cs 895 B

1234567891011121314151617181920212223242526272829
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Sirenix.OdinInspector;
  5. namespace KairoEngine.CharacterSystem
  6. {
  7. public class DoorTrigger : MonoBehaviour
  8. {
  9. public DoorController doorController;
  10. public List<CharacterController> charactersInRange = new List<CharacterController>();
  11. void OnTriggerEnter(Collider co)
  12. {
  13. CharacterController character = co.gameObject.transform.root.GetComponentInChildren<CharacterController>();
  14. if(character == null) return;
  15. charactersInRange.Add(character);
  16. }
  17. void OnTriggerExit(Collider co)
  18. {
  19. CharacterController character = co.gameObject.transform.root.GetComponentInChildren<CharacterController>();
  20. if(character == null) return;
  21. charactersInRange.Remove(character);
  22. }
  23. }
  24. }