extends EnemyState class_name EnemySearch @export var max_search_time : float = 10.0 @export var scan_time : float = 3 @export var scan_cone_angle : float = 90 var search_timer = max_search_time var scan_timer var scan_direction = scan_cone_angle/2 func Enter(): scan_timer = scan_time get_new_point_of_interest() func Update(delta): if search_timer > 0: search_timer -= delta update_minimap(0,1.0,ColorSwatch.ORANGE_COLOR) attack_on_sight() #on timeout change scan direction if scan_timer > 0: scan_timer -= delta else: change_scan_direction() else: Transitioned.emit(self,"idle") func Physics_Update(delta): #if navigation is finished get new point, otherwise continue on path if character.nav_agent.is_navigation_finished(): if has_points_to_investigate(): get_new_point_of_interest() else: Transitioned.emit(self,"idle") else: move_to_nav_point(delta) #do turret scan turret_scan(Vector3(0,scan_direction,0),delta) func change_scan_direction(): scan_timer = scan_time scan_direction = -scan_direction