private void Update() { if (_health.Islive()) { if (IsSight()) { if (chaseMode == ChaseMode.Shooter) { _canApproach = Vector3.Distance(transform.position, target.position) > distanceToStop; } if (_canApproach) { Vector2 direction = target.position - transform.position; float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg; _movement.Rotate(angle); _movement.MoveForward(direction, movementSpeed); } } } if (!_health.Islive() || !IsSight()) { _movement.FreezeRigidbody(); } }