* Ajout des achievement Steam * Ajout d'une annonce à la récupération d'un artefact et ajout de textes axplicatifs sur les annonces d'artefacts et de mutation * Fix du léger glitch des tooltips * Ajout de clarté sur la machine de respawn dans le vaisseau
86 lines
2.6 KiB
GDScript
86 lines
2.6 KiB
GDScript
@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):
|
|
if is_node_ready():
|
|
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("Unlock_tool")
|
|
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
|