Attack Target

Merlins Beard . Actions . Attack Target

Serialized Fields

Chase Range :: float

Used to determine when the Target has moved outside the range of the Attacker.

Chase Action :: Action

The chase Action replaces the current Action when the Target has moved outside of the Attacker’s chase range.

Methods

Initialize ( Brain :: Brain )

Retrieves and stores the Focus and Attacker components on the Brain.

Execute ( )

Calculates the range from the Attacker to the Target. If the Target is in range and the angle to the Target is within the attack arc, then the Attacker executes its current Attack.

If the Target is within range but outside the attack arc, then the Attacker turns to face the target.

If the Target is out of the current Attack range, then the Attacker moves towards the Target. If the Target is out of the chase range, then the Attacker replaces this action with the chase Action.

Cancel ( )

When this Action is cancelled, the Target is cleared from the Focus component.