mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-27 22:41:56 +08:00
fix(BulletBase): 添加canDoDuplicate控制子弹分裂和折射行为
防止子弹在不应该分裂或折射时执行这些操作,通过新增的canDoDuplicate布尔变量来控制
This commit is contained in:
@@ -8,6 +8,7 @@ script = ExtResource("2_nxpf5")
|
||||
speed = 5.0
|
||||
penerate = 1.0
|
||||
lifeTime = 4000.0
|
||||
canDoDuplicate = false
|
||||
|
||||
[node name="texture" parent="." index="0"]
|
||||
modulate = Color(1, 0.7075234, 0.6972954, 1)
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user