mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-07-02 00:02:13 +08:00
fix(BulletBase): 添加canDoDuplicate控制子弹分裂和折射行为
防止子弹在不应该分裂或折射时执行这些操作,通过新增的canDoDuplicate布尔变量来控制
This commit is contained in:
@@ -8,6 +8,7 @@ script = ExtResource("2_nxpf5")
|
|||||||
speed = 5.0
|
speed = 5.0
|
||||||
penerate = 1.0
|
penerate = 1.0
|
||||||
lifeTime = 4000.0
|
lifeTime = 4000.0
|
||||||
|
canDoDuplicate = false
|
||||||
|
|
||||||
[node name="texture" parent="." index="0"]
|
[node name="texture" parent="." index="0"]
|
||||||
modulate = Color(1, 0.7075234, 0.6972954, 1)
|
modulate = Color(1, 0.7075234, 0.6972954, 1)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class_name BulletBase
|
|||||||
@export var freeAfterSpawn: bool = false
|
@export var freeAfterSpawn: bool = false
|
||||||
@export var knockback: float = 0 # 击退力,物理引擎单位
|
@export var knockback: float = 0 # 击退力,物理引擎单位
|
||||||
@export var recoil: float = 0 # 后坐力,物理引擎单位
|
@export var recoil: float = 0 # 后坐力,物理引擎单位
|
||||||
|
@export var canDoDuplicate: bool = true # 是否可以分裂、折射
|
||||||
|
|
||||||
@onready var animator: AnimationPlayer = $"%animator"
|
@onready var animator: AnimationPlayer = $"%animator"
|
||||||
@onready var hitbox: CollisionShape2D = $"%hitbox"
|
@onready var hitbox: CollisionShape2D = $"%hitbox"
|
||||||
@@ -135,8 +136,9 @@ func dotLoop():
|
|||||||
func tryDestroy(becauseMap: bool = false):
|
func tryDestroy(becauseMap: bool = false):
|
||||||
if destroying: return
|
if destroying: return
|
||||||
destroying = true
|
destroying = true
|
||||||
trySplit()
|
if canDoDuplicate:
|
||||||
tryRefract()
|
trySplit()
|
||||||
|
tryRefract()
|
||||||
await destroy(becauseMap)
|
await destroy(becauseMap)
|
||||||
if autoDestroyAnimation:
|
if autoDestroyAnimation:
|
||||||
animator.play("destroy")
|
animator.play("destroy")
|
||||||
|
|||||||
Reference in New Issue
Block a user