60 lines
1.4 KiB
GDScript
60 lines
1.4 KiB
GDScript
extends Node2D
|
|
|
|
const DARK_CUT_SCENE = preload("res://operation/prototype_dark_cut.tscn")
|
|
const DIALOG_SCENE = preload("res://dialog.tscn")
|
|
const RITUAL_BOOK_SCENE = preload("res://prototype_ritual_book.tscn")
|
|
|
|
|
|
@onready var room: Node2D = $Room
|
|
@onready var shelves: Node2D = $Shelves
|
|
|
|
|
|
func _ready():
|
|
_show_dialog()
|
|
|
|
func _on_dialog_finished(dialog: Dialog):
|
|
dialog.queue_free()
|
|
_enable_node2d(room)
|
|
_enable_node2d(shelves)
|
|
|
|
func _on_bob_clicked():
|
|
_show_dialog()
|
|
|
|
func _show_dialog():
|
|
_disable_node2d(room)
|
|
_disable_node2d(shelves)
|
|
var dialog = DIALOG_SCENE.instantiate()
|
|
dialog.dialog_finished.connect(_on_dialog_finished.bind(dialog))
|
|
dialog.text_box_label = %TextBoxLabel
|
|
add_child.call_deferred(dialog)
|
|
|
|
func _on_ritual_place_clicked():
|
|
_disable_node2d(room)
|
|
var dark_cut = DARK_CUT_SCENE.instantiate()
|
|
dark_cut.succeeded.connect(_on_dark_cut_succeeded.bind(dark_cut))
|
|
dark_cut.failed.connect(_on_dark_cut_failed.bind(dark_cut))
|
|
add_child.call_deferred(dark_cut)
|
|
|
|
func _on_dark_cut_succeeded(dark_cut: DarkCut):
|
|
dark_cut.queue_free()
|
|
_show_room()
|
|
|
|
func _on_dark_cut_failed(dark_cut: DarkCut):
|
|
dark_cut.queue_free()
|
|
_show_room()
|
|
|
|
func _show_room():
|
|
_enable_node2d(room)
|
|
_enable_node2d(shelves)
|
|
|
|
func _disable_node2d(node: Node2D):
|
|
node.hide()
|
|
node.set_deferred("process", false)
|
|
|
|
func _enable_node2d(node: Node2D):
|
|
node.show()
|
|
node.set_deferred("process", true)
|
|
|
|
|
|
func _on_ritual_book_clicked():
|
|
pass # Replace with function body.
|