mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-27 22:41:56 +08:00
fix(BulletBase): 添加父节点有效性检查防止崩溃
在子弹分裂和折射时检查父节点是否有效,避免无效引用导致的崩溃
This commit is contained in:
@@ -152,7 +152,8 @@ func trySplit():
|
||||
cloned.rotation += deg_to_rad(360.0 / total * i + 180)
|
||||
cloned.canDuplicateSelf = false
|
||||
cloned.launcher = launcher
|
||||
cloned.parent = parent
|
||||
if is_instance_valid(parent):
|
||||
cloned.parent = parent
|
||||
get_parent().add_child.call_deferred(split(cloned, i, total, last))
|
||||
func tryRefract():
|
||||
if is_instance_valid(launcher) and canDuplicateSelf:
|
||||
@@ -173,7 +174,8 @@ func tryRefract():
|
||||
cloned.look_at(entity.position)
|
||||
cloned.canDuplicateSelf = false
|
||||
cloned.launcher = launcher
|
||||
cloned.parent = parent
|
||||
if is_instance_valid(parent):
|
||||
cloned.parent = parent
|
||||
get_parent().add_child.call_deferred(refract(cloned, entity, i, total, last))
|
||||
|
||||
# 抽象方法
|
||||
|
||||
Reference in New Issue
Block a user