* Equilibrage de la difficulté (suite) * Correction du timing des dialogues de Demeter * Dev de la base astra (avec les logs) * Fix de bug de duplication d'objets * Fix de la mutation ancien * Ajout d'une mention de la propagation des mutations dans le tuto
51 lines
1.3 KiB
GDScript
51 lines
1.3 KiB
GDScript
extends Area3D
|
|
class_name Interactable3D
|
|
|
|
@export var interactable := true : set = set_interactable
|
|
|
|
@export var inspectable := false
|
|
|
|
signal clicked
|
|
|
|
@export var hover_animation_player : AnimationPlayer
|
|
@export var audio_player : AudioStreamPlayer3D
|
|
|
|
func _ready():
|
|
set_interactable()
|
|
|
|
func click(_player3d : Player3D):
|
|
if interactable:
|
|
clicked.emit()
|
|
|
|
func play_audio():
|
|
if audio_player:
|
|
audio_player.play()
|
|
|
|
func stop_audio():
|
|
if audio_player:
|
|
audio_player.stop()
|
|
|
|
func _on_mouse_entered():
|
|
if hover_animation_player and interactable and hover_animation_player.has_animation("hover"):
|
|
hover_animation_player.play("hover")
|
|
if inspectable:
|
|
Pointer.inspect(self)
|
|
|
|
func _on_mouse_exited():
|
|
if hover_animation_player:
|
|
hover_animation_player.stop()
|
|
if inspectable:
|
|
Pointer.stop_inspect(self)
|
|
|
|
func card_info() -> CardInfo:
|
|
return null
|
|
|
|
func set_interactable(i := interactable):
|
|
interactable = i
|
|
|
|
if is_node_ready() and hover_animation_player:
|
|
if i and hover_animation_player.has_animation("activated"):
|
|
hover_animation_player.play("activated")
|
|
if not i and hover_animation_player.has_animation("deactivated"):
|
|
hover_animation_player.play("deactivated")
|