mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 15:01:53 +08:00
feat(子弹系统): 添加QKSword子弹及其处理逻辑
实现QKSword子弹类型,包括子弹行为、生成逻辑和命中效果 - 新增QKSwordBullet类,实现追踪目标功能 - 新增QKSwordHandler处理命中后的子弹生成 - 修改ParryBall使其命中时生成QKSword子弹 - 调整CycleTimer的子弹偏移计算 - 为BulletBase添加afterSpawn回调
This commit is contained in:
@@ -9,3 +9,14 @@ func spawn():
|
||||
func ai():
|
||||
PresetBulletAI.selfRotate(self , 5)
|
||||
hitbox.disabled = !launcher.sprinting
|
||||
func succeedToHit(_dmg: float, entity: EntityBase):
|
||||
for bullet in BulletBase.generate(
|
||||
ComponentManager.getBullet("QKSword"),
|
||||
launcher,
|
||||
entity.position,
|
||||
0
|
||||
):
|
||||
if bullet is QKSwordBullet:
|
||||
bullet.position = entity.texture.global_position + MathTool.sampleInRing(50, 200)
|
||||
bullet.tracer = entity
|
||||
bullet.look_at(entity.position)
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
extends BulletBase
|
||||
class_name QKSwordBullet
|
||||
|
||||
var tracer: EntityBase
|
||||
|
||||
func ai():
|
||||
if is_instance_valid(tracer):
|
||||
look_at(tracer.position)
|
||||
if timeLived() > 1000:
|
||||
PresetBulletAI.forward(self , rotation)
|
||||
@@ -0,0 +1 @@
|
||||
uid://chyrnrbgcudmk
|
||||
@@ -0,0 +1,14 @@
|
||||
extends BulletBase
|
||||
class_name QKSwordHandler
|
||||
|
||||
func succeedToHit(_dmg: float, entity: EntityBase):
|
||||
for bullet in BulletBase.generate(
|
||||
ComponentManager.getBullet("QKSword"),
|
||||
launcher,
|
||||
entity.position,
|
||||
0
|
||||
):
|
||||
if bullet is QKSwordBullet:
|
||||
bullet.position = entity.texture.global_position + MathTool.sampleInRing(50, 200)
|
||||
bullet.tracer = entity
|
||||
bullet.look_at(entity.position)
|
||||
@@ -0,0 +1 @@
|
||||
uid://cmph2bim5oro5
|
||||
@@ -71,6 +71,7 @@ func _ready():
|
||||
if autoSpawnAnimation:
|
||||
animator.play("spawn")
|
||||
await animator.animation_finished
|
||||
afterSpawn()
|
||||
if freeAfterSpawn:
|
||||
tryDestroy()
|
||||
func _process(_delta: float) -> void:
|
||||
@@ -214,6 +215,8 @@ func destroy(_beacuseMap: bool):
|
||||
pass
|
||||
func spawn():
|
||||
pass
|
||||
func afterSpawn():
|
||||
pass
|
||||
func applyDot():
|
||||
pass
|
||||
func succeedToHit(_dmg: float, _entity: EntityBase):
|
||||
|
||||
@@ -19,7 +19,7 @@ func apply():
|
||||
for index in len(bullets):
|
||||
var bullet = bullets[index]
|
||||
var offset = Vector2.from_angle(periodPercent(index))
|
||||
offset.y *= 0.5
|
||||
offset.y *= 0.25
|
||||
bullet.position = bullet.launcher.position + offset * distance
|
||||
bullet.scale = Vector2.ONE * (1 + offset.y)
|
||||
func host(bullet: BulletBase):
|
||||
|
||||
Reference in New Issue
Block a user