Dev Beta 1.3
* Ajout d'un déblocage des mutations, dans une scène 3D trouvable dans les runs, ainsi qu'un dialogue d'annonce de ces scènes * Augmentation des charges par map à 10 et augmentation des objectifs de points de plantes en conséquence * Modification du loot des graines : les plantes donnent désormais un nombre fixe de graine et les graines issues de veine de Talion n'obtiennent pas automatiquement de mutations * Les portes ne seront désormais plus sur de la pierre * Amélioration du tutoriel pour inclure une section d'explication des mutations * Ajout du modificateur de région Magnétique qui divise l'objectif et les recharges par 2 *
This commit is contained in:
45
entities/interactable_3d/cristal/scripts/cristal.gd
Normal file
45
entities/interactable_3d/cristal/scripts/cristal.gd
Normal file
@@ -0,0 +1,45 @@
|
||||
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
|
||||
%CristalModelCrack1.visible = break_level == 1
|
||||
%CristalModelCrack2.visible = break_level > 1
|
||||
|
||||
if break_level > 1:
|
||||
%CristalModelCrack2.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
|
||||
);
|
||||
1
entities/interactable_3d/cristal/scripts/cristal.gd.uid
Normal file
1
entities/interactable_3d/cristal/scripts/cristal.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dwn3g8c5sa0a2
|
||||
@@ -0,0 +1,80 @@
|
||||
@tool
|
||||
extends CanvasLayer
|
||||
class_name MutationAnnounce
|
||||
|
||||
const DEFAULT_OBJECT_ACCELERATION = Vector2(3,0)
|
||||
|
||||
@export var announce_mutation : PlantMutation = null : set = set_announce_mutation
|
||||
|
||||
@export_tool_button("Update", "Callable") var update_action = set_announce_mutation
|
||||
|
||||
var announce_objects : Array[AnnouceObject] = []
|
||||
|
||||
var object_acceleration := Vector2(0,0)
|
||||
|
||||
var rotating := false
|
||||
|
||||
var prev_mouse_pos : Vector2
|
||||
var next_mouse_pos : Vector2
|
||||
|
||||
const YELLOW_COLOR = Color("e29f32")
|
||||
const RED_COLOR = Color("f20058")
|
||||
|
||||
func _ready():
|
||||
set_announce_mutation()
|
||||
%OkButton.button_down.connect(_on_ok_button_down)
|
||||
hide()
|
||||
|
||||
func _process(delta):
|
||||
update_rotation(delta)
|
||||
|
||||
func update_rotation(delta):
|
||||
if visible:
|
||||
next_mouse_pos = get_viewport().get_mouse_position()
|
||||
if Input.is_action_just_pressed("action"):
|
||||
rotating = true
|
||||
prev_mouse_pos = get_viewport().get_mouse_position()
|
||||
if Input.is_action_just_released("action"):
|
||||
rotating = false
|
||||
object_acceleration = Vector2(
|
||||
float(next_mouse_pos.x - prev_mouse_pos.x),
|
||||
float(next_mouse_pos.y - prev_mouse_pos.y)
|
||||
)
|
||||
|
||||
var object_rotation = object_acceleration
|
||||
|
||||
if rotating:
|
||||
object_rotation = Vector2(
|
||||
float(next_mouse_pos.x - prev_mouse_pos.x),
|
||||
float(next_mouse_pos.y - prev_mouse_pos.y)
|
||||
)
|
||||
prev_mouse_pos = next_mouse_pos
|
||||
else :
|
||||
object_acceleration = object_acceleration.lerp(DEFAULT_OBJECT_ACCELERATION, 0.1)
|
||||
|
||||
%AnnouceObject.rotate(Vector3.UP, object_rotation.x * delta)
|
||||
%AnnouceObject.rotate(Vector3.RIGHT, object_rotation.y * delta)
|
||||
|
||||
|
||||
func set_announce_mutation(mutation := announce_mutation):
|
||||
|
||||
if is_node_ready() and mutation:
|
||||
|
||||
%AnnounceTitle.text = "NEW_MUTATION"
|
||||
%AnnounceText.text = mutation.get_mutation_name()
|
||||
%MutationIconTextureRect.texture = mutation.get_icon()
|
||||
%ObjectVisualiser.info = mutation.card_info()
|
||||
|
||||
if not visible:
|
||||
%AnimationPlayer.play("appear")
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
AudioManager.play_sfx("Reveal")
|
||||
elif mutation == null and visible:
|
||||
%AnimationPlayer.play_backwards("appear")
|
||||
|
||||
if not Engine.is_editor_hint():
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
announce_mutation = mutation
|
||||
|
||||
func _on_ok_button_down():
|
||||
announce_mutation = null
|
||||
@@ -0,0 +1 @@
|
||||
uid://c0tyivmiouctw
|
||||
Reference in New Issue
Block a user