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

refactor(武器系统): 重构武器冷却和攻击逻辑

- 将CooldownTimer的startCooldown方法重命名为更简洁的start
- 为EntityBase添加weaponStore节点管理武器
- 修改武器攻击逻辑,现在由Weapon类自身处理冷却和攻击
- 调整武器卡片的UI布局和描述居中显示
- 为Rooster角色添加预设武器
This commit is contained in:
2025-09-06 07:40:21 +08:00
parent c16a1ee73c
commit debb450044
8 changed files with 51 additions and 18 deletions
+4 -1
View File
@@ -24,11 +24,14 @@ signal selected(applied: bool)
@onready var costsBox: GridContainer = $"%costs"
@onready var selectButton: Button = $"%selectBtn"
var cooldownTimer = CooldownTimer.new()
func _ready():
selectButton.pressed.connect(
func():
apply(UIState.player)
)
cooldownTimer.cooldown = cooldown
rebuildInfo()
func _physics_process(_delta: float):
descriptionLabel.text = buildDescription()
@@ -76,7 +79,7 @@ func buildDescription():
var result = descriptionTemplate
for key in store.keys():
result = result.replace("$" + key, "[color=cyan]%.1f[/color]" % readStore(key))
return result
return "[center]%s[/center]" % result
func readStore(key: String, default: Variant = null):
return store.get(key, default)