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

feat(技能图标): 添加冷却进度百分比功能并优化能量显示

为CooldownTimer添加percent方法计算冷却进度百分比
重构SkillIcon使用新的冷却进度和能量填充进度计算
添加白色圆圈SVG资源作为粒子效果
优化EntityBase的能量计算方法
更新SkillIcon场景配置
This commit is contained in:
2026-01-24 09:43:25 +08:00
parent aa7bcdf8f4
commit 0138d1017f
6 changed files with 57 additions and 9 deletions
+2
View File
@@ -18,3 +18,5 @@ func start():
return state
func timeSinceLastStart():
return WorldManager.getTime() - lastStart
func percent():
return timeSinceLastStart() / centralTime()
+5 -1
View File
@@ -277,8 +277,12 @@ func collectItem(itemType: ItemStore.ItemType, amount: int):
func storeEnergy(value: float, dontChangeDirection: bool = false):
energy += value * fields.get(FieldStore.Entity.ENERGY_MULTIPILER)
energyChanged.emit(energy, dontChangeDirection)
func finalEnergy(base: float):
return base / fields.get(FieldStore.Entity.SAVE_ENERGY)
func fillingProgress(base: float):
return energy / finalEnergy(base)
func useEnergy(value: float):
value /= fields.get(FieldStore.Entity.SAVE_ENERGY)
value = finalEnergy(value)
var state = energy >= value
if state:
energy -= value
+2 -2
View File
@@ -13,11 +13,11 @@ func _ready():
func _physics_process(_delta):
if is_instance_valid(weapon):
textureRect.texture = weapon.avatarTexture
var progress = min(weapon.cooldownTimer.timeSinceLastStart() / weapon.cooldownTimer.cooldown, UIState.player.energy / weapon.needEnergy)
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
particle.emitting = true
else:
showed = false