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
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
@tool
|
||||
extends CanvasLayer
|
||||
class_name ArtefactAnnounce
|
||||
|
||||
const DEFAULT_OBJECT_ACCELERATION = Vector2(3,0)
|
||||
|
||||
@export var announce_artefact : Artefact = null : set = set_announce_artefact
|
||||
|
||||
@export_tool_button("Update", "Callable") var update_action = set_announce_artefact
|
||||
|
||||
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_artefact()
|
||||
%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_artefact(artefact := announce_artefact):
|
||||
|
||||
for c in %AnnouceObject.get_children():
|
||||
c.queue_free()
|
||||
|
||||
if is_node_ready() and artefact:
|
||||
|
||||
%AnnounceTitle.text = "NEW_ARTEFACT"
|
||||
%AnnounceText.text = artefact.get_artefact_name()
|
||||
%ObjectVisualiser.info = artefact.card_info()
|
||||
|
||||
%AnnouceObject.add_child(
|
||||
artefact.get_3d_scene().instantiate()
|
||||
)
|
||||
|
||||
if not visible:
|
||||
%AnimationPlayer.play("appear")
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
AudioManager.play_sfx("Reveal")
|
||||
elif artefact == null and visible:
|
||||
%AnimationPlayer.play_backwards("appear")
|
||||
|
||||
if not Engine.is_editor_hint():
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
|
||||
announce_artefact = artefact
|
||||
|
||||
func _on_ok_button_down():
|
||||
announce_artefact = null
|
||||
@@ -0,0 +1 @@
|
||||
uid://xamd5y6tig71
|
||||
@@ -42,3 +42,13 @@ func unlock_mutation():
|
||||
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
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user