update
This commit is contained in:
@@ -4,6 +4,8 @@ extends Node
|
||||
signal action_stoped
|
||||
signal object_placed()
|
||||
|
||||
|
||||
@export var area: Area3D
|
||||
var build_name: String = "None"
|
||||
|
||||
|
||||
@@ -38,6 +40,7 @@ func set_person_pos(person):
|
||||
for pose in persons_position:
|
||||
if pose.is_free:
|
||||
pose.set_person(person)
|
||||
break
|
||||
|
||||
|
||||
func find_pose(person):
|
||||
|
||||
@@ -39,8 +39,10 @@ func _input(event: InputEvent) -> void:
|
||||
show_context_menu.emit()
|
||||
|
||||
func _on_interact(person, object):
|
||||
object.start_action(person, object)
|
||||
|
||||
if object.name == "ActionNode":
|
||||
object.start_action(person, object)
|
||||
else:
|
||||
object.ActionNode.start_action(person, object)
|
||||
|
||||
func _on_object_selected(object):
|
||||
if object_selected != null and object != object_selected:
|
||||
|
||||
@@ -11,7 +11,7 @@ func _ready() -> void:
|
||||
|
||||
func start_action(person, object):
|
||||
person.action = self
|
||||
person.visible = false
|
||||
set_person_pos(person)
|
||||
person.set_timer(5)
|
||||
|
||||
func stop_action(person, object):
|
||||
print("action stoped")
|
||||
|
||||
@@ -79,16 +79,22 @@ func set_target_position():
|
||||
var newPos = target_object.global_position
|
||||
newPos.y = self.position.y
|
||||
nav_agent.target_position = newPos
|
||||
|
||||
if target_object.name != "ActionNode":
|
||||
target_object.ActionNode.area.body_entered.connect(on_target_reached)
|
||||
else:
|
||||
target_object.area.body_entered.connect(on_target_reached)
|
||||
#nav_agent.target_position = start_pos
|
||||
|
||||
|
||||
func on_target_reached(body):
|
||||
print("I reached ")
|
||||
if body == self:
|
||||
if target_object != null:
|
||||
print("I reached a target")
|
||||
is_target_reached = true
|
||||
nav_agent.target_position = self.global_position
|
||||
Global.interact.emit(self, target_object)
|
||||
func _on_navigation_agent_3d_target_reached() -> void:
|
||||
if target_object != null:
|
||||
print("I reached a target")
|
||||
is_target_reached = true
|
||||
nav_agent.target_position = self.global_position
|
||||
Global.interact.emit(self, target_object)
|
||||
|
||||
pass
|
||||
|
||||
func set_timer(time):
|
||||
|
||||
@@ -60,3 +60,8 @@ func go_cook():
|
||||
else:
|
||||
print("I cant find free pot")
|
||||
pass
|
||||
|
||||
|
||||
func cook(person, object):
|
||||
person.set_timer(5)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user