more tweaks to ai
This commit is contained in:
@@ -4,12 +4,12 @@ class_name EnemyState
|
||||
@export var enemy : CharacterBody3D
|
||||
@export var move_speed : float = 3
|
||||
@export var can_see : bool = false # indicates whether the enemy is able to see things in the state
|
||||
@export var time_to_lose_target = 1.0
|
||||
|
||||
@onready var target_lost_timer = time_to_lose_target
|
||||
|
||||
func Update(delta):
|
||||
if can_see:
|
||||
if enemy.is_player_in_area() and enemy.is_player_visible():
|
||||
Transitioned.emit(self,"attack")
|
||||
pass
|
||||
|
||||
func move_target():
|
||||
if enemy.player_last_seen != null:
|
||||
@@ -22,3 +22,12 @@ func move_target():
|
||||
return move_point["point"]
|
||||
else:
|
||||
Transitioned.emit(self,"idle")
|
||||
|
||||
func attack_on_sight():
|
||||
if can_see:
|
||||
if enemy.is_player_in_area() and enemy.is_player_visible():
|
||||
Transitioned.emit(self,"attack")
|
||||
|
||||
func search_on_lost_target(delta):
|
||||
if !enemy.is_player_visible():
|
||||
Transitioned.emit(self,"attack")
|
||||
|
||||
Reference in New Issue
Block a user