mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
0138d1017f
为CooldownTimer添加percent方法计算冷却进度百分比 重构SkillIcon使用新的冷却进度和能量填充进度计算 添加白色圆圈SVG资源作为粒子效果 优化EntityBase的能量计算方法 更新SkillIcon场景配置
24 lines
641 B
GDScript
24 lines
641 B
GDScript
extends PanelContainer
|
|
class_name SkillIcon
|
|
|
|
@export var weapon: Weapon = null;
|
|
|
|
@onready var textureRect: TextureRect = $"%texture"
|
|
@onready var particle: GPUParticles2D = $"%particle"
|
|
|
|
var showed: bool = false
|
|
|
|
func _ready():
|
|
material = material.duplicate()
|
|
func _physics_process(_delta):
|
|
if is_instance_valid(weapon):
|
|
textureRect.texture = weapon.avatarTexture
|
|
var progress = min(weapon.cooldownTimer.percent(), UIState.player.fillingProgress(weapon.needEnergy))
|
|
material.set_shader_parameter("progress", progress)
|
|
particle.emitting = progress >= 1
|
|
if progress >= 1:
|
|
if !showed:
|
|
showed = true
|
|
else:
|
|
showed = false
|