seeEnemy method

PolygonShape? seeEnemy({
  1. required dynamic observed(
    1. List<Enemy>
    ),
  2. VoidCallback? notObserved,
  3. double radiusVision = 32,
  4. double? visionAngle,
  5. double? angle,
})

This method we notify when detect the enemy when enter in radiusVision configuration Method that bo used in update method. visionAngle in radians angle in radians. is automatically picked up using the component's direction.

Implementation

PolygonShape? seeEnemy({
  required Function(List<Enemy>) observed,
  VoidCallback? notObserved,
  double radiusVision = 32,
  double? visionAngle,
  double? angle,
}) {
  if (isDead) return null;
  return seeComponentType<Enemy>(
    observed: observed,
    notObserved: notObserved,
    radiusVision: radiusVision,
    angle: angle ?? lastDirection.toRadians(),
    visionAngle: visionAngle,
  );
}