Reworked the AI Objectives
This commit is contained in:
parent
27964084ff
commit
a6c9909f26
8 changed files with 31 additions and 11 deletions
|
@ -28,7 +28,10 @@ func _ready() -> void:
|
|||
func _timer_done() -> void:
|
||||
if angry_meter > 0:
|
||||
angry_meter -= 1
|
||||
if target is Objective:
|
||||
($Label3D as Label3D).text = "%s %ds left" % [(target as Objective).displayed, angry_meter]
|
||||
else:
|
||||
($Label3D as Label3D).text = ""
|
||||
timer.stop()
|
||||
phase = 2
|
||||
find_player(99999999999999)
|
||||
|
@ -37,7 +40,7 @@ func _timer_done() -> void:
|
|||
func find_rest() -> void:
|
||||
var lowest_distance: float = 99999999999999
|
||||
for child: Node in get_tree().root.get_node("/root/"+Game.mapname+"/NPCRestPlaces").get_children():
|
||||
if child is Rest and position.distance_to((child as Rest).position) < lowest_distance and !(child as Rest).occupied:
|
||||
if child is Objective and position.distance_to((child as Objective).position) < lowest_distance and !(child as Objective).occupied:
|
||||
target = child
|
||||
|
||||
navigation_agent.set_target_position(target.position)
|
||||
|
@ -59,8 +62,8 @@ func _physics_process(_delta: float) -> void:
|
|||
|
||||
if navigation_agent.is_navigation_finished():
|
||||
if phase == 0:
|
||||
if target is Rest:
|
||||
(target as Rest).occupied = false
|
||||
if target is Objective:
|
||||
(target as Objective).occupied = false
|
||||
phase = 1
|
||||
timer.start()
|
||||
return
|
||||
|
@ -74,5 +77,3 @@ func _physics_process(_delta: float) -> void:
|
|||
pass
|
||||
|
||||
Networking.npc_sync_call(position, rotation, name)
|
||||
|
||||
|
||||
|
|
|
@ -15,11 +15,12 @@ var freecam: bool = false
|
|||
var camera_rotation: Vector2 = Vector2(0,0)
|
||||
|
||||
func _ready() -> void:
|
||||
($Label3D as Label3D).text = name
|
||||
if name == Game.username:
|
||||
activated = true
|
||||
camera.current = true
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
|
||||
($Label3D as Label3D).hide()
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if activated:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue