mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
3a8c48dae7
refactor(角色): 将MTY角色从猫头鹰改为狗熊宝宝并调整攻击逻辑 fix(子弹): 修复ParryBall和Parrier子弹的实例有效性检查 style(场景): 清理场景文件中的冗余属性 feat(工具): 为findClosetBulletCanDamage添加最大距离参数 chore(配置): 更新测试用的波次配置
30 lines
918 B
GDScript
30 lines
918 B
GDScript
extends BulletBase
|
|
class_name ParryBallBullet
|
|
|
|
var cycler: CycleTimer
|
|
var atk: float = 1
|
|
|
|
func spawn():
|
|
cycler = launcher.getOrCreateCycleTimer("parry")
|
|
cycler.host(self )
|
|
launcher.sprintMultiplier += 1
|
|
func destroy(_beacuseMap: bool):
|
|
if is_instance_valid(launcher):
|
|
launcher.sprintMultiplier -= 1
|
|
func ai():
|
|
PresetBulletAI.selfRotate(self , 5)
|
|
hitbox.disabled = !launcher.sprinting # 玩家在冲刺时气的碰撞箱才生效
|
|
hitbox.global_position = launcher.position
|
|
func succeedToHit(_dmg: float, entity: EntityBase): # 当撞到敌人时
|
|
for bullet in BulletBase.generate(
|
|
ComponentManager.getBullet("QKSword"),
|
|
launcher,
|
|
entity.position,
|
|
0
|
|
):
|
|
if bullet is QKSwordBullet:
|
|
bullet.baseDamage = atk
|
|
bullet.position = entity.texture.global_position + MathTool.sampleInRing(200, 500)
|
|
bullet.tracer = entity
|
|
bullet.look_at(entity.getTrackingAnchor()) # 生成的乾坤剑面向敌人
|