1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 15:01:53 +08:00
Files
Dog-Lynx-And-HCN/scripts/Statemachine/SkillIcon.gd
T
fallingshrimp 38390e7ded fix(SkillIcon): 修复技能图标冷却进度显示问题
调整ShaderMaterial的默认progress值为0.5以匹配实际冷却状态
在_ready中复制材质实例避免共享材质引用
分离progress计算逻辑提高可读性
2025-09-06 15:46:39 +08:00

15 lines
483 B
GDScript

extends PanelContainer
class_name SkillIcon
@export var weapon: Weapon = null;
@onready var textureRect: TextureRect = $"%texture"
func _ready():
textureRect.material = textureRect.material.duplicate()
func _physics_process(_delta):
if is_instance_valid(weapon):
textureRect.texture = weapon.avatarTexture
var progress = weapon.cooldownTimer.timeSinceLastStart() / weapon.cooldownTimer.cooldown
textureRect.material.set_shader_parameter("progress", clamp(progress, 0, 1))