mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-29 07:21:54 +08:00
c5d21b68ba
重构CooldownTimer类,添加初始化方法支持自定义冷却时间 将EntityBase中的单一冷却计时器改为基于攻击类型的映射管理 简化Wave类中的预设波次数据结构,移除未使用的测试波次
18 lines
357 B
GDScript
18 lines
357 B
GDScript
class_name CooldownTimer
|
|
|
|
var cooldown: float = 100
|
|
var lastStart: int = 0
|
|
|
|
func _init(cd: float = 100):
|
|
cooldown = cd
|
|
|
|
func isCooldowned():
|
|
return timeSinceLastStart() >= cooldown
|
|
func start():
|
|
var state = isCooldowned()
|
|
if state:
|
|
lastStart = WorldManager.getTime()
|
|
return state
|
|
func timeSinceLastStart():
|
|
return WorldManager.getTime() - lastStart
|