2025-09-06 15:04:32 +08:00
|
|
|
extends PanelContainer
|
2025-09-06 15:24:50 +08:00
|
|
|
class_name SkillIcon
|
2025-09-06 15:04:32 +08:00
|
|
|
|
|
|
|
|
@export var weapon: Weapon = null;
|
|
|
|
|
|
2025-09-06 15:46:39 +08:00
|
|
|
@onready var textureRect: TextureRect = $"%texture"
|
2025-09-06 15:04:32 +08:00
|
|
|
|
2025-09-06 15:46:39 +08:00
|
|
|
func _ready():
|
|
|
|
|
textureRect.material = textureRect.material.duplicate()
|
2025-09-06 15:04:32 +08:00
|
|
|
func _physics_process(_delta):
|
|
|
|
|
if is_instance_valid(weapon):
|
|
|
|
|
textureRect.texture = weapon.avatarTexture
|
2025-09-06 15:46:39 +08:00
|
|
|
var progress = weapon.cooldownTimer.timeSinceLastStart() / weapon.cooldownTimer.cooldown
|
2025-09-06 16:40:25 +08:00
|
|
|
textureRect.material.set_shader_parameter("progress", progress)
|