mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
feat(武器系统): 重构武器攻击逻辑并添加音效支持
- 将武器攻击逻辑移至Weapon类中,添加tryAttack方法统一处理冷却和能量消耗 - 为武器添加音效支持,包括攻击音效的播放和管理 - 移除子弹生成时的能量消耗检查,改由武器统一处理 - 调整部分武器的属性和配置,如伤害值和冷却时间 - 修复紫水晶子弹的分裂和折射逻辑错误
This commit is contained in:
@@ -199,7 +199,7 @@ func tryAttack(type: int, needChargeUp: bool = false):
|
||||
weapon = weapons[type]
|
||||
var state
|
||||
if isPlayer():
|
||||
state = weapon.cooldownTimer.start()
|
||||
state = true
|
||||
else:
|
||||
cooldownTimer.cooldown = attackCooldownMap.get(type, defaultCooldownUnit)
|
||||
state = cooldownTimer.start()
|
||||
@@ -208,13 +208,12 @@ func tryAttack(type: int, needChargeUp: bool = false):
|
||||
charginup = true
|
||||
await EffectController.create(preload("res://components/Effects/AttackStar.tscn"), damageAnchor.global_position).shot()
|
||||
charginup = false
|
||||
var done
|
||||
if isPlayer():
|
||||
done = weapon.attack(self)
|
||||
if weapon.tryAttack(self):
|
||||
weapon.playSound("attack")
|
||||
else:
|
||||
done = attack(type)
|
||||
if done:
|
||||
playSound("attack" + str(type))
|
||||
if attack(type):
|
||||
playSound("attack" + str(type))
|
||||
return state
|
||||
func trySprint():
|
||||
trailing = true
|
||||
|
||||
Reference in New Issue
Block a user