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

fix(BulletBase): 添加canDoDuplicate控制子弹分裂和折射行为

防止子弹在不应该分裂或折射时执行这些操作,通过新增的canDoDuplicate布尔变量来控制
This commit is contained in:
2026-01-23 23:59:02 +08:00
parent 3746a6c73b
commit 41d1b544c9
2 changed files with 5 additions and 2 deletions
+4 -2
View File
@@ -19,6 +19,7 @@ class_name BulletBase
@export var freeAfterSpawn: bool = false
@export var knockback: float = 0 # 击退力,物理引擎单位
@export var recoil: float = 0 # 后坐力,物理引擎单位
@export var canDoDuplicate: bool = true # 是否可以分裂、折射
@onready var animator: AnimationPlayer = $"%animator"
@onready var hitbox: CollisionShape2D = $"%hitbox"
@@ -135,8 +136,9 @@ func dotLoop():
func tryDestroy(becauseMap: bool = false):
if destroying: return
destroying = true
trySplit()
tryRefract()
if canDoDuplicate:
trySplit()
tryRefract()
await destroy(becauseMap)
if autoDestroyAnimation:
animator.play("destroy")