progress
This commit is contained in:
29
SetPiece_.gd
29
SetPiece_.gd
@@ -12,7 +12,7 @@ extends Polygon2D
|
||||
func _ready():
|
||||
self.color.a = 0.25
|
||||
if Engine.is_editor_hint():
|
||||
self.color.a = 0.25
|
||||
self.color.a = 0.25
|
||||
notify_property_list_changed()
|
||||
pass
|
||||
else:
|
||||
@@ -20,6 +20,10 @@ func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
signal interacted
|
||||
signal walked
|
||||
signal looked
|
||||
signal touched
|
||||
signal talked
|
||||
signal entered(lab)
|
||||
signal exited
|
||||
|
||||
@@ -33,7 +37,7 @@ func _process(delta):
|
||||
else:
|
||||
if Geometry2D.is_point_in_polygon(to_local(get_global_mouse_position()), self.polygon):
|
||||
if is_in == false:
|
||||
is_in = true
|
||||
is_in = true
|
||||
emit_signal("entered", label)
|
||||
else:
|
||||
if is_in == true:
|
||||
@@ -47,4 +51,23 @@ func _input(event):
|
||||
if Geometry2D.is_point_in_polygon(to_local(get_global_mouse_position()), self.polygon):
|
||||
if event is InputEventMouseButton and event.is_action("interact"):
|
||||
get_viewport().set_input_as_handled()
|
||||
emit_signal("interacted")
|
||||
|
||||
# Check if interacted signal has connections - it takes precedence
|
||||
if interacted.get_connections().size() > 0:
|
||||
emit_signal("interacted")
|
||||
return
|
||||
|
||||
# Otherwise, emit action-specific signal based on current cursor
|
||||
match ActionState.current_action:
|
||||
ActionState.Action.WALK:
|
||||
if walked.get_connections().size() > 0:
|
||||
emit_signal("walked")
|
||||
ActionState.Action.LOOK:
|
||||
if looked.get_connections().size() > 0:
|
||||
emit_signal("looked")
|
||||
ActionState.Action.TOUCH:
|
||||
if touched.get_connections().size() > 0:
|
||||
emit_signal("touched")
|
||||
ActionState.Action.TALK:
|
||||
if talked.get_connections().size() > 0:
|
||||
emit_signal("talked")
|
||||
|
||||
Reference in New Issue
Block a user