private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player") && other.TryGetComponent(out PlayerController player)) { TargetFound?.Invoke(player); } }
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(); } }
private void OnTargetFound(Link page, Link[] links) { TargetFound?.Invoke(page, links); }