2024-12-18 16:35:26 -05:00
|
|
|
class_name IconHover extends Button
|
|
|
|
|
2024-12-31 23:31:28 -05:00
|
|
|
@export var showIcon: bool = false
|
2024-12-18 16:35:26 -05:00
|
|
|
@export var iconTex: Texture
|
2024-12-31 23:31:28 -05:00
|
|
|
@export var hoverPlayer: AudioStreamPlayer
|
|
|
|
@export var clickPlayer: AudioStreamPlayer
|
2024-12-18 16:35:26 -05:00
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
func _ready():
|
|
|
|
mouse_entered.connect(onHover)
|
|
|
|
mouse_exited.connect(onLeave)
|
2024-12-31 23:31:28 -05:00
|
|
|
pressed.connect(onClick)
|
2024-12-18 16:35:26 -05:00
|
|
|
|
|
|
|
func onHover() -> void:
|
|
|
|
icon = iconTex
|
2024-12-31 23:31:28 -05:00
|
|
|
hoverPlayer.play()
|
2024-12-18 16:35:26 -05:00
|
|
|
|
|
|
|
func onLeave() -> void:
|
|
|
|
icon = null
|
2024-12-31 23:31:28 -05:00
|
|
|
|
|
|
|
func onClick() -> void:
|
|
|
|
clickPlayer.play()
|