25 lines
674 B
GDScript
25 lines
674 B
GDScript
class_name WallDoorway extends ItemInteractable
|
|
|
|
func _ready() -> void:
|
|
state_changed.connect(_on_state_changed)
|
|
interaction_area.interact = Callable(self, "_on_interact")
|
|
state = States.closed
|
|
|
|
func _on_interact() -> void:
|
|
match state:
|
|
States.closed:
|
|
animation_player.play("open")
|
|
#recalculate_navigation_map.emit(self)
|
|
state = States.opened
|
|
States.opened:
|
|
animation_player.play("close")
|
|
#recalculate_navigation_map.emit(self)
|
|
state = States.closed
|
|
|
|
func _on_state_changed(new_state: States) -> void:
|
|
match new_state:
|
|
States.closed:
|
|
interaction_area.action_name = "open door"
|
|
States.opened:
|
|
interaction_area.action_name = "close door"
|