mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
38390e7ded
调整ShaderMaterial的默认progress值为0.5以匹配实际冷却状态 在_ready中复制材质实例避免共享材质引用 分离progress计算逻辑提高可读性
15 lines
483 B
GDScript
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))
|