mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
feat(战斗系统): 实现弹反效果并调整相关参数
- 新增Parry效果控制器及关联资源 - 为EffectController添加beforeShot钩子方法 - 调整Parrier子弹的碰撞形状和动画时长 - 实现弹反成功时的击退效果和视觉反馈 - 修改默认波次配置用于测试
This commit is contained in:
@@ -20,6 +20,14 @@ func spawn():
|
||||
eff.texture.scale.x *= -1
|
||||
eff.texture.sprite_frames = frames
|
||||
eff.shot()
|
||||
func succeedToHit(_dmg: float, entity: EntityBase):
|
||||
if parryiedTimes < maxParryTimes:
|
||||
parryiedTimes += 1
|
||||
var eff = EffectController.create(ComponentManager.getEffect("Parry"), entity.position)
|
||||
eff.rotation = position.angle_to_point(entity.position)
|
||||
eff.shot()
|
||||
launcher.impluse((position - entity.position).normalized() * 600)
|
||||
entity.impluse((entity.position - position).normalized() * 600)
|
||||
func hitBullet(bullet: BulletBase): # 当前子弹与其他子弹相撞
|
||||
if BulletTool.canDamage(bullet, launcher): # 其他子弹可以使当前子弹的发射者受伤吗?
|
||||
if parryiedTimes < maxParryTimes && MathTool.rate(parryRate): # 一个刀光最多格挡多少个敌方子弹?
|
||||
@@ -29,7 +37,6 @@ func hitBullet(bullet: BulletBase): # 当前子弹与其他子弹相撞
|
||||
eff.modulate = bullet.modulate.blend(bullet.texture.modulate)
|
||||
eff.rotation = position.angle_to_point(bullet.position)
|
||||
eff.shot()
|
||||
CameraManager.shake(250, 300)
|
||||
launcher.impluse((position - bullet.position).normalized() * (bullet.speed * bullet.getDamage()) ** (1.0 / 3) * 250)
|
||||
var targetBaseDamage = bullet.baseDamage
|
||||
# 弹反 还是 格挡?
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
extends EffectController
|
||||
class_name ParryEffect
|
||||
|
||||
func beforeShot():
|
||||
CameraManager.shake(200, 300)
|
||||
@@ -0,0 +1 @@
|
||||
uid://mirrohsweqtb
|
||||
@@ -49,7 +49,7 @@ static var WAVE_JUSTJOKE = [
|
||||
Wave.create("Kernyr", 0, 0, true, 0, INF, 1),
|
||||
]
|
||||
static var WAVE_EMPTY = []
|
||||
static var waveConfig = [WAVE_JUSTJOKE, 10]
|
||||
static var waveConfig = [WAVE_NORMAL, 1]
|
||||
|
||||
static var current: int = startWith(1) if WorldManager.isRelease() else startWith(waveConfig[1])
|
||||
static var data = WAVE_NORMAL if WorldManager.isRelease() else waveConfig[0]
|
||||
|
||||
@@ -20,6 +20,7 @@ func _physics_process(_delta):
|
||||
if lockTexture:
|
||||
texture.global_rotation = 0
|
||||
func shot():
|
||||
beforeShot()
|
||||
var childParticle = particles.duplicate() as GPUParticles2D
|
||||
childParticle.emitting = true
|
||||
add_child(childParticle)
|
||||
@@ -48,6 +49,8 @@ func shot():
|
||||
|
||||
func register():
|
||||
pass
|
||||
func beforeShot():
|
||||
pass
|
||||
|
||||
static func create(scene: PackedScene, spawnPosition: Vector2, parent: Node = null) -> EffectController:
|
||||
var cloned = scene.instantiate() as EffectController
|
||||
|
||||
Reference in New Issue
Block a user