NpcExtensions extension

Created by

─▄▀─▄▀ ──▀──▀ █▀▀▀▀▀█▄ █░░░░░█─█ ▀▄▄▄▄▄▀▀

Rafaelbarbosatec on 22/03/22

on

Properties

playerRect Rect
Gets player position used how base in calculations
no setter

Methods

directionThatPlayerIs() Direction
Gives the direction of the player in relation to this component
getAngleFromPlayer() double
Get angle between enemy and player player as a base
getInverseAngleFromPlayer() double
Get angle between enemy and player enemy position as a base
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. visionAngle in radians angle in radians. is automatically picked up using the component's direction.
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 player is within range. If so, move to it. visionAngle in radians angle in radians. is automatically picked up using the component's direction.
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}) Shape?
Checks whether the player is within range. If so, move to it. visionAngle in radians angle in radians. is automatically picked up using the component's direction.
seePlayer({required dynamic observed(Player), VoidCallback? notObserved, double radiusVision = 32, double? visionAngle, double? angle}) Shape?
This method we notify when detect the player 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.