85 lines
2.1 KiB
GDScript
85 lines
2.1 KiB
GDScript
extends Node2D
|
|
|
|
var timerStarted = false;
|
|
|
|
var defaultCursor = load("res://resources/cursors/arrow2.webp");
|
|
|
|
var flameState;
|
|
|
|
func _ready():
|
|
if not get_tree().root.has_node("Root"):
|
|
return ;
|
|
|
|
GallerySingleton.AddBackground("DomikVnutri");
|
|
|
|
var dialogicNode = get_parent().get_parent().get_node("Game").get_child(0).get_child(0)
|
|
dialogicNode.connect("dialogic_signal", self, "_domik_listener")
|
|
flameState = 0;
|
|
|
|
var sfxPath = "res://resources/audio/sfx/pomeschenie-snaruji-dojd-i-groza.ogg"
|
|
get_tree().root.get_node("Root").SetSFXforBGM(sfxPath)
|
|
|
|
|
|
func _domik_listener(value):
|
|
if value == "start_timer":
|
|
timerStarted = true;
|
|
$DeathTimer.start();
|
|
$Flame.visible = true;
|
|
elif value == "barrel":
|
|
var trapdoor = $ClosedTrapdoor;
|
|
trapdoor.visible = true;
|
|
var modulateValue = Color(1, 1, 1, 1);
|
|
$TrapdoorTween.interpolate_property(trapdoor, "modulate", trapdoor.modulate, modulateValue, 1.25, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT, 0)
|
|
$TrapdoorTween.start();
|
|
pass;
|
|
elif value == "trapdoor":
|
|
var trapdoor = $OpenedTrapdoor;
|
|
trapdoor.visible = true;
|
|
var modulateValue = Color(1, 1, 1, 1);
|
|
$TrapdoorTween.interpolate_property(trapdoor, "modulate", trapdoor.modulate, modulateValue, 0.5, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT, 0)
|
|
$TrapdoorTween.start();
|
|
pass;
|
|
|
|
func _process(_delta):
|
|
if not timerStarted:
|
|
return ;
|
|
|
|
var value = $DeathTimer.time_left;
|
|
|
|
if flameState == 0:
|
|
|
|
|
|
$Flame / flame.position.y = 155 * (value - 90) / 9 + 710;
|
|
|
|
|
|
elif flameState == 1:
|
|
|
|
|
|
$Flame / flame.position.y = 6 * (value - 40) - 840;
|
|
|
|
|
|
func _on_DeathTimer_timeout():
|
|
timerStarted = false;
|
|
|
|
Input.set_custom_mouse_cursor(defaultCursor);
|
|
|
|
var alternative = get_parent().get_parent().get_node("AlternativeChoices/Control");
|
|
|
|
if alternative != null:
|
|
alternative.TimerOut();
|
|
|
|
else :
|
|
Dialogic.set_variable("PreviousTimelineChoice", "END");
|
|
|
|
|
|
$DeathTimer.disconnect("timeout", self, "_on_DeathTimer_timeout");
|
|
flameState = 1;
|
|
$DeathTimer.start(40);
|
|
timerStarted = true;
|
|
|
|
func InitForGallery()->Array:
|
|
scale = Vector2(0.5, 0.5)
|
|
return [];
|
|
|
|
func SetSettings(setting):
|
|
pass;
|