mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 23:11:54 +08:00
0138d1017f
为CooldownTimer添加percent方法计算冷却进度百分比 重构SkillIcon使用新的冷却进度和能量填充进度计算 添加白色圆圈SVG资源作为粒子效果 优化EntityBase的能量计算方法 更新SkillIcon场景配置
23 lines
499 B
GDScript
23 lines
499 B
GDScript
class_name CooldownTimer
|
|
|
|
var cooldown: float = 100
|
|
var lastStart: int = 0
|
|
var speedScale: float = 1
|
|
|
|
func _init(cd: float = 100):
|
|
cooldown = cd
|
|
|
|
func centralTime():
|
|
return cooldown / speedScale
|
|
func isCooldowned():
|
|
return timeSinceLastStart() >= centralTime()
|
|
func start():
|
|
var state = isCooldowned()
|
|
if state:
|
|
lastStart = WorldManager.getTime()
|
|
return state
|
|
func timeSinceLastStart():
|
|
return WorldManager.getTime() - lastStart
|
|
func percent():
|
|
return timeSinceLastStart() / centralTime()
|