seeEnemy method
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,
);
}