1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-27 22:41:56 +08:00

fix(EffectController): 修复oneShot效果后未释放自身的问题

feat(EntityBase): 添加获取生命值百分比的方法
refactor(BulletBase): 重命名scene变量为parentScene以提高可读性
fix(BlueCrystal): 修正弹道追踪旋转计算错误
style(EffectBase): 调整场景文件格式和属性顺序
This commit is contained in:
2025-12-14 13:36:48 +08:00
parent 04dbd5d6db
commit b5edbc5b13
5 changed files with 11 additions and 8 deletions
+5 -5
View File
@@ -35,7 +35,7 @@ var isChildRefract: bool = false
var initialSpeed: float = 0
var initialDamage: float = 0
var speedScale: float = 1
var scene: PackedScene = null
var parentScene: PackedScene = null
func _ready():
initialSpeed = speed
@@ -146,8 +146,8 @@ func trySplit():
func tryRefract():
if is_instance_valid(launcher) and !isChildRefract:
var value = launcher.fields.get(FieldStore.Entity.BULLET_REFRACTION)
var entity = EntityTool.findClosetEntity(position, get_tree(), !launcher.isPlayer(), launcher.isPlayer())
for i in range(MathTool.shrimpRate(value)):
var entity = EntityTool.findClosetEntity(position, get_tree(), !launcher.isPlayer(), launcher.isPlayer(), [launcher])
if is_instance_valid(entity):
refract(entity, i, value, value - floor(value))
@@ -166,7 +166,7 @@ func register():
pass
func split(index: int, total: int, _lastBullet: float):
BulletBase.generate(
scene,
parentScene,
launcher,
position,
rotation + deg_to_rad(360.0 / total * index),
@@ -175,7 +175,7 @@ func split(index: int, total: int, _lastBullet: float):
)
func refract(entity: EntityBase, _index: int, _total: int, _lastBullet: float):
BulletBase.generate(
scene,
parentScene,
launcher,
position,
position.angle_to_point(entity.position) if is_instance_valid(entity) else randf_range(0, deg_to_rad(360)),
@@ -202,7 +202,7 @@ static func generate(
instance.isChildRefract = asChildRefract
instance.launcher = launchBy
instance.position = spawnPosition
instance.scene = bullet
instance.parentScene = bullet
instance.rotation = spawnRotation + deg_to_rad(launchBy.fields.get(FieldStore.Entity.OFFSET_SHOOT) * randf_range(-1, 1) * int(!ignoreOffset))
if addToWorld:
WorldManager.rootNode.call_deferred("add_child", instance)