NpcExtensions extension

Created by

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

Rafaelbarbosatec on 22/03/22

on

Properties

playerRect Rect

Available on Npc, provided by the NpcExtensions extension

Gets player position used how base in calculations
no setter

Methods

getAngleToPlayer() double

Available on Npc, provided by the NpcExtensions extension

Get angle between enemy and player player as a base
getDirectionToPlayer() Direction?

Available on Npc, provided by the NpcExtensions extension

Gives the direction of the player in relation to this component
getInverseAngleToPlayer() double

Available on Npc, provided by the NpcExtensions extension

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

Available on Npc, provided by the NpcExtensions extension

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

Available on Npc, provided by the NpcExtensions extension

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?

Available on Npc, provided by the NpcExtensions extension

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?

Available on Npc, provided by the NpcExtensions extension

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.