1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-01 00:41:54 +08:00

fix(SkillIcon): 修复技能图标冷却进度显示问题

调整ShaderMaterial的默认progress值为0.5以匹配实际冷却状态
在_ready中复制材质实例避免共享材质引用
分离progress计算逻辑提高可读性
This commit is contained in:
2025-09-06 15:46:39 +08:00
parent 4d8969c47d
commit 38390e7ded
2 changed files with 6 additions and 3 deletions
+5 -2
View File
@@ -3,9 +3,12 @@ class_name SkillIcon
@export var weapon: Weapon = null;
@onready var textureRect = $"%texture"
@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
textureRect.material.set_shader_parameter("progress", clamp(weapon.cooldownTimer.timeSinceLastStart() / weapon.cooldownTimer.cooldown, 0, 1))
var progress = weapon.cooldownTimer.timeSinceLastStart() / weapon.cooldownTimer.cooldown
textureRect.material.set_shader_parameter("progress", clamp(progress, 0, 1))