refactor: unify interactable components
This commit is contained in:
@@ -19,9 +19,22 @@ class_name CafeCompanionTarget
|
||||
var _lastClickMsec: int = 0
|
||||
|
||||
func _ready() -> void:
|
||||
var interactable: InteractableComponent = InteractableComponent.new()
|
||||
interactable.interaction_distance = 160.0
|
||||
add_child(interactable)
|
||||
input_pickable = true
|
||||
set_process_unhandled_input(true)
|
||||
|
||||
func is_interaction_active(_component: InteractableComponent) -> bool:
|
||||
return not servicePointId.strip_edges().is_empty() and not companionId.strip_edges().is_empty()
|
||||
|
||||
func build_interaction_actions(_component: InteractableComponent, _player: Node2D) -> Array[InteractionAction]:
|
||||
var actions: Array[InteractionAction] = []
|
||||
var display_name: String = _resolved_persona_name()
|
||||
var action_id: String = "cafe_companion:%s" % servicePointId
|
||||
actions.append(InteractionAction.create(action_id, "与 %s 交流" % display_name, 45, Callable(self, "_try_emit_target_selected")))
|
||||
return actions
|
||||
|
||||
func _input_event(_viewport: Viewport, event: InputEvent, _shapeIdx: int) -> void:
|
||||
if not (event is InputEventMouseButton):
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user