mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-06-13 07:07:12 +08:00
feat(战斗系统): 添加新武器"树"及其配套子弹和特效
实现新的近战武器"树",包含以下内容: - 添加武器Tree.gd脚本及场景资源 - 新增Parrier子弹类型,支持子弹碰撞检测和反弹效果 - 添加武器攻击音效和子弹命中特效 - 修改BulletBase.gd以支持子弹间碰撞逻辑 - 更新角色预设装备新武器
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
extends BulletBase
|
||||
class_name ParrierBullet
|
||||
|
||||
func hitBullet(bullet: BulletBase):
|
||||
if BulletTool.canDamage(bullet, launcher):
|
||||
EffectController.create(ComponentManager.getEffect("Parry"), position).shot()
|
||||
bullet.tryDestroy()
|
||||
tryDestroy()
|
||||
func ai():
|
||||
PresetBulletAI.forward(self , rotation)
|
||||
@@ -0,0 +1 @@
|
||||
uid://bi7nde2rs0w4m
|
||||
@@ -0,0 +1,13 @@
|
||||
@tool
|
||||
extends Weapon
|
||||
|
||||
func attack(entity: EntityBase):
|
||||
for bullet in BulletBase.generate(
|
||||
ComponentManager.getBullet("Parrier"),
|
||||
entity,
|
||||
entity.findWeaponAnchor("normal"),
|
||||
entity.findWeaponAnchor("normal").angle_to_point(get_global_mouse_position()),
|
||||
):
|
||||
if bullet is ParrierBullet:
|
||||
pass
|
||||
return true
|
||||
@@ -0,0 +1 @@
|
||||
uid://bqdyhwcd4jwmj
|
||||
@@ -51,11 +51,6 @@ func _ready():
|
||||
spawnInWhere = position
|
||||
spawn()
|
||||
dotLoop()
|
||||
if autoSpawnAnimation:
|
||||
animator.play("spawn")
|
||||
await animator.animation_finished
|
||||
if freeAfterSpawn:
|
||||
tryDestroy()
|
||||
if autoLoopAnimation:
|
||||
animator.play("loop")
|
||||
if autoPlayTexture:
|
||||
@@ -66,7 +61,18 @@ func _ready():
|
||||
if autoDestroyOnHitMap:
|
||||
tryDestroy(true)
|
||||
)
|
||||
area_entered.connect(
|
||||
func(body):
|
||||
var bullet = BulletTool.fromArea(body)
|
||||
if is_instance_valid(bullet):
|
||||
hitBullet(bullet)
|
||||
)
|
||||
ai()
|
||||
if autoSpawnAnimation:
|
||||
animator.play("spawn")
|
||||
await animator.animation_finished
|
||||
if freeAfterSpawn:
|
||||
tryDestroy()
|
||||
func _process(_delta: float) -> void:
|
||||
if destroying: return
|
||||
if lifeTime > 0:
|
||||
@@ -218,6 +224,8 @@ func split(newBullet: BulletBase, _index: int, _total: int, _lastBullet: float):
|
||||
return newBullet
|
||||
func refract(newBullet: BulletBase, _entity: EntityBase, _index: int, _total: int, _lastBullet: float):
|
||||
return newBullet
|
||||
func hitBullet(_bullet: BulletBase):
|
||||
pass
|
||||
|
||||
static func generate(
|
||||
bullet: PackedScene,
|
||||
|
||||
Reference in New Issue
Block a user