Files
seeding-planets/entities/interactable_3d/cristal/scripts/cristal.gd
Zacharie Guet 87d0feb338 Encore du dev beta 1.4
* réparation de la scène région
* quand toutes les mutation sont découvertes, les cristaux offrent un artefact (le relai Talion)
* changer le volume dans les settings fait jouer un son de test
* fix d'une traduction sur le relai de Talion
2026-05-17 14:21:21 +02:00

55 lines
1.5 KiB
GDScript

extends Interactable3D
const MAX_BREAK_LEVEL = 2
signal broken
@export var break_level = 0
func _ready():
update_model()
func click():
if interactable:
clicked.emit()
%BreackAudioPlayer.playing = true
%BreakParticles.emitting = true
break_level += 1
if break_level == MAX_BREAK_LEVEL:
broken.emit()
interactable = false
unlock_mutation()
update_model()
func update_model():
if is_node_ready():
%CristalModel.visible = break_level == 0
%CristalModelCrack.visible = break_level > 0
if break_level > 1:
%CristalModelCrack.find_children("AnimationPlayer")[0].play("Break")
func unlock_mutation():
var progression = GameInfo.game_data.progression_data
if progression.mutations_unlocked < len(progression.get_all_mutations()):
var new_mutation : PlantMutation = progression.get_all_mutations()[progression.mutations_unlocked]
progression.mutations_unlocked += 1
get_tree().create_timer(1.).timeout.connect(
func (): %MutationAnnounce.announce_mutation = new_mutation
);
else:
var talion_relay = TalionRelayArtifact.new()
if GameInfo.game_data and GameInfo.game_data.current_region_data and GameInfo.game_data.current_run:
GameInfo.game_data.current_run.add_artefacts(talion_relay)
get_tree().create_timer(1.).timeout.connect(
func (): %ArtefactAnnounce.announce_artefact = talion_relay
);