JetCharacterDetection.cs 646 B

12345678910111213141516171819202122232425262728
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace JTSystems
  5. {
  6. [RequireComponent(typeof(JetCharacter))]
  7. public class JetCharacterDetection : MonoBehaviour
  8. {
  9. // Start is called before the first frame update
  10. void Start()
  11. {
  12. }
  13. // Update is called once per frame
  14. void Update()
  15. {
  16. }
  17. private void OnTriggerEnter(Collider other)
  18. {
  19. if (InterfaceUtility.HasInterface<ICollectable>(other.gameObject))
  20. other.GetComponent<ICollectable>().Collect(GetComponent<JetCharacter>());
  21. }
  22. }
  23. }