2024-07-12 14:32:33 +02:00
|
|
|
class_name QuestState
|
|
|
|
extends Node
|
|
|
|
|
2024-07-15 22:20:49 +02:00
|
|
|
@export var is_wrench_found:bool = false
|
|
|
|
@export var is_wrench_delivered:bool = false
|
|
|
|
@export var is_bridge_built:bool = false
|
|
|
|
|
|
|
|
@onready var bridge = %Bridge
|
|
|
|
|
|
|
|
var _bridge_transform:Transform3D = Transform3D.IDENTITY
|
|
|
|
|
|
|
|
signal wrench_delivered
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
_bridge_transform = bridge.global_transform
|
|
|
|
bridge.global_transform = Transform3D.IDENTITY.translated(Vector3.UP * -1000)
|
|
|
|
|
|
|
|
func on_dialogue_ended(_dialog_resource: DialogueResource) -> void:
|
|
|
|
if is_wrench_delivered:
|
|
|
|
print ("Will build bridge!")
|
|
|
|
emit_signal("wrench_delivered")
|
|
|
|
|
|
|
|
|
|
|
|
func update_state_from_player_inventory(inventory: Inventory) -> void:
|
|
|
|
for item:Item in inventory.get_items():
|
|
|
|
if item.name == "Wrench":
|
|
|
|
is_wrench_found = true
|
|
|
|
|
|
|
|
|
|
|
|
func _process(_delta):
|
|
|
|
if is_wrench_delivered:
|
|
|
|
is_bridge_built = true
|
|
|
|
bridge.global_transform = _bridge_transform
|