des indices d'intéractions à base de shaders et de bulles
This commit is contained in:
@@ -11,6 +11,7 @@ var humanInteractionTarget: Human = null
|
||||
@onready var animation_tree := $AnimationTree
|
||||
@onready var animation_player := $AnimationPlayer
|
||||
@onready var state_machine := animation_tree.get("parameters/HumanState/playback") as AnimationNodeStateMachinePlayback
|
||||
@onready var interactionZone : InteractionZone = $"interaction zone"
|
||||
|
||||
signal start_intracting
|
||||
|
||||
@@ -56,9 +57,9 @@ func _physics_process(delta):
|
||||
|
||||
updateFacingDirectionInAnimationTree()
|
||||
|
||||
if wants_to_interact_with and wants_to_interact_with.get_parent().has_method("start_interaction"):
|
||||
if wants_to_interact_with and wants_to_interact_with.has_method("start_interaction"):
|
||||
if humanInteractionTarget == null:
|
||||
humanInteractionTarget = wants_to_interact_with.get_parent() as Human
|
||||
humanInteractionTarget = wants_to_interact_with as Human
|
||||
humanInteractionTarget.start_interaction(self)
|
||||
|
||||
func _on_area_2d_body_entered(body: Node2D) -> void:
|
||||
@@ -66,9 +67,25 @@ func _on_area_2d_body_entered(body: Node2D) -> void:
|
||||
|
||||
func start_interaction(askingForInteraction: Human):
|
||||
emit_signal("start_intracting", askingForInteraction)
|
||||
disable_interaction_clue()
|
||||
|
||||
func stop_interaction():
|
||||
humanInteractionTarget = null
|
||||
enable_interaction_clue()
|
||||
|
||||
func get_feet_global_position():
|
||||
return global_position + Vector2(0, 43)
|
||||
|
||||
func enable_interaction_clue():
|
||||
if interactionZone:
|
||||
var mat = $Sprite2D.get("material") as ShaderMaterial
|
||||
if mat:
|
||||
mat.set_shader_parameter("line_thickness", 1)
|
||||
interactionZone.enable_interaction_clue()
|
||||
|
||||
func disable_interaction_clue():
|
||||
if interactionZone:
|
||||
var mat = $Sprite2D.get("material") as ShaderMaterial
|
||||
if mat:
|
||||
mat.set_shader_parameter("line_thickness", 0)
|
||||
interactionZone.disable_interaction_clue()
|
||||
|
||||
Reference in New Issue
Block a user