private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player") && other.TryGetComponent(out PlayerController player))
     {
         TargetFound?.Invoke(player);
     }
 }
示例#2
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     if (collision.gameObject.TryGetComponent(out Player player))
     {
         _target = player;
         TargetFound?.Invoke();
     }
 }
 private void FixedUpdate()
 {
     if (TargetIsClose())
     {
         transform.LookAt(_target);
         TargetFound?.Invoke();
     }
     else
     {
         TargetLost?.Invoke();
     }
 }
示例#4
0
 private void OnTargetFound(Link page, Link[] links)
 {
     TargetFound?.Invoke(page, links);
 }