Skip to content

ChasingState ​

Inherits: ActionState < Resource

ChasingState with LOS-aware navigation that repositions when stuck

Variables ​

floatattack_range1.0
Vector3last_target_positionVector3.ZERO
intrepositioning_attempts0

Methods ​

voidenter()
voidexit()
voidupdate( delta: float )
voidupdate_attack_range()
boolis_in_attack_range()
boolis_ready_to_attack()

Constants ​

  • int MAX_REPOSITIONING_ATTEMPTS = 3 - How many times the entity moves to get a clear line to its target before it gives up.

Variable descriptions ​

float attack_range = 1.0 ​

Calculated attack range distance

Vector3 last_target_position = Vector3.ZERO ​

Track target position to avoid spam updates

int repositioning_attempts = 0 ​

Counter to prevent infinite repositioning attempts

Method descriptions ​

void enter() ​

Called when entering the chasing state

void exit() ​

Called when exiting the chasing state

void update( delta: float ) ​

Called every frame to update the chasing state

void update_attack_range() ​

Updates the attack range based on basic attack

bool is_in_attack_range() ​

Checks if the entity is within attack range of its target

bool is_ready_to_attack() ​

Checks if the entity can attack (in range AND has line of sight)