VisionApi class
API for managing vision/line-of-sight behavior.
Constructors
- VisionApi(GameComponent _comp)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cleanCache(
) → void - Clears the cached vision polygon shapes.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
render(
Canvas canvas) → void -
Renders the vision shape if
drawVisionis enabled. -
seeAndMoveToAlly(
{required dynamic closeAlly(Ally), BoolCallback? notObserved, VoidCallback? observed, VoidCallback? notCanMove, double radiusVision = 32, double? visionAngle, double? angle, double margin = 10, bool runOnlyVisibleInScreen = true, MovementAxis movementAxis = MovementAxis.all}) → void -
Checks whether the ally is within range. If so, move to it.
visionAnglein radians.anglein radians. -
seeAndMoveToAttackRange<
T extends GameComponent> ({dynamic positioned(T)?, BoolCallback? notObserved, dynamic observed(T)?, double radiusVision = 32, double? visionAngle, double? angle, double? minDistanceFromPlayer, bool useDiagonal = true}) → void -
Checks whether the
Tcomponents are within attack range. If so, move to them and callpositionedwhen in range.visionAnglein radians.anglein radians. -
seeAndMoveToEnemy(
{required dynamic closeEnemy(Enemy), BoolCallback? notObserved, VoidCallback? observed, VoidCallback? notCanMove, double radiusVision = 32, double? visionAngle, double? angle, double margin = 10, bool runOnlyVisibleInScreen = true, MovementAxis movementAxis = MovementAxis.all}) → void -
Checks whether the enemy is within range. If so, move to it.
visionAnglein radians.anglein radians. -
seeAndMoveToPlayer(
{dynamic closePlayer(Player)?, BoolCallback? notObserved, VoidCallback? observed, VoidCallback? notCanMove, double radiusVision = 32, double margin = 2, double? visionAngle, double? angle, bool runOnlyVisibleInScreen = true, MovementAxis movementAxis = MovementAxis.all}) → PolygonShape? -
Checks if the player is within range. If so, move to it.
visionAnglein radians.anglein radians. -
seeComponent(
GameComponent component, {required dynamic observed(GameComponent), VoidCallback? notObserved, double radiusVision = 32, double? visionAngle, double angle = 3.14159}) → PolygonShape? -
Checks if
componentis within vision range.visionAnglein radians.anglein radians. -
seeComponentType<
T extends GameComponent> ({required void observed(List< T> ), VoidCallback? notObserved, double radiusVision = 32, double? visionAngle, double angle = 3.14159}) → PolygonShape? -
Checks if any component of type
Tis within vision range.visionAnglein radians.anglein radians. -
seeEnemy(
{required dynamic observed(List< Enemy> ), VoidCallback? notObserved, double radiusVision = 32, double? visionAngle, double? angle}) → PolygonShape? -
Checks if any enemy is within vision range.
visionAnglein radians.anglein radians. -
seePlayer(
{required dynamic observed(Player), VoidCallback? notObserved, double radiusVision = 32, double? visionAngle, double? angle}) → PolygonShape? -
Checks if the player is within vision range.
visionAnglein radians.anglein radians. -
setup(
{Color? color, bool drawVision = false, bool checkWithRaycast = true, int countPolygonPoints = 20}) → void -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- VISION_360 → const double