improvements to ai but still needs a lot of work
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user