improvements to ai but still needs a lot of work

This commit is contained in:
derek
2025-04-28 16:32:34 -05:00
parent f0ec7bc953
commit 80cf7ec2c5
8 changed files with 83 additions and 34 deletions

View File

@@ -7,19 +7,18 @@ class_name EnemyState
func Update(delta):
if enemy.visibility_areas != null:
for area in enemy.visibility_areas:
var bodies = area.get_overlapping_bodies()
if bodies != null:
for i in bodies:
if i is Player:
enemy.character_follow = i
else:
enemy.character_follow = null
if enemy.character_follow != null:
if can_see:
if enemy.is_player_visible():
enemy.cache_player_pos()
Transitioned.emit(self,"attack")
if can_see:
if enemy.is_player_in_area() and enemy.is_player_visible():
Transitioned.emit(self,"attack")
func move_target():
if enemy.player_last_seen != null:
return enemy.player_last_seen
elif enemy.points_of_interest.size() > 0:
var move_point = {"loudness" : 0.0,"point" : Vector3.ZERO}
for point in enemy.points_of_interest:
if point["loudness"] > move_point["loudness"]:
move_point = point
return move_point["point"]
else:
Transitioned.emit(self,"idle")