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

feat(武器系统): 新增可蓄力钢管武器及相关功能

实现钢管武器的蓄力攻击机制,包括:
- 添加 Pipe 武器和 PipeBullet 子弹脚本及场景
- 在 Weapon 类中增加蓄力相关属性和方法
- 修改 Rooster 角色以支持武器蓄力功能
- 添加武器蓄力时间计算和伤害加成逻辑
This commit is contained in:
2026-02-05 20:04:39 +08:00
parent d83abc7078
commit 53412c0968
9 changed files with 121 additions and 21 deletions
+39 -15
View File
@@ -11,11 +11,8 @@ func register():
elif bullet is FoxZhua:
EffectController.create(ComponentManager.getEffect("BloodFall"), texture.global_position).shot()
)
# if !WorldManager.isRelease():
# getItem({
# ItemStore.ItemType.BEACHBALL: INF,
# ItemStore.ItemType.SOUL: INF
# })
var chargeStartTime = {}
func ai():
texture.play("walk")
var direction = Vector2(
@@ -25,17 +22,27 @@ func ai():
move(direction)
if direction.length() == 0:
texture.play("idle")
if Input.is_action_pressed("attack"):
tryAttack(0)
if Input.is_action_pressed("attack2"):
tryAttack(1)
if Input.is_action_pressed("smallSkill"):
tryAttack(2)
if Input.is_action_pressed("superSkill"):
tryAttack(3)
if Input.is_action_just_pressed("attack"):
startCharge(0)
if Input.is_action_just_released("attack"):
endCharge(0)
if Input.is_action_just_pressed("attack2"):
startCharge(1)
if Input.is_action_just_released("attack2"):
endCharge(1)
if Input.is_action_just_pressed("smallSkill"):
startCharge(2)
if Input.is_action_just_released("smallSkill"):
endCharge(2)
if Input.is_action_just_pressed("superSkill"):
startCharge(3)
if Input.is_action_just_released("superSkill"):
endCharge(3)
for i in range(3):
if Input.is_action_pressed("cardSkill" + str(i)):
tryAttack(4 + i)
if Input.is_action_just_pressed("cardSkill" + str(i)):
startCharge(4 + i)
if Input.is_action_just_released("cardSkill" + str(i)):
endCharge(4 + i)
if Input.is_action_just_pressed("sprint"):
trySprint()
if Input.is_action_just_pressed("heal"):
@@ -49,3 +56,20 @@ func sprint():
Input.get_axis("m_left", "m_right"),
Input.get_axis("m_up", "m_down")
) * sprintMultiplier, true)
func startCharge(weaponIndex: int):
if len(weapons) > weaponIndex:
var weapon = weapons[weaponIndex]
if weapon.chargable:
chargeStartTime[weaponIndex] = Time.get_ticks_msec()
func endCharge(weaponIndex: int):
if chargeStartTime.has(weaponIndex):
var startTime = chargeStartTime[weaponIndex]
var endTime = Time.get_ticks_msec()
var chargedTime = endTime - startTime
chargeStartTime.erase(weaponIndex)
if len(weapons) > weaponIndex:
var weapon = weapons[weaponIndex]
if weapon.chargable:
weapon.chargedTime = chargedTime
tryAttack(weaponIndex)