mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
feat(子弹): 为魔法飞弹添加命中动画和音效
refactor(角色): 将MTY角色从猫头鹰改为狗熊宝宝并调整攻击逻辑 fix(子弹): 修复ParryBall和Parrier子弹的实例有效性检查 style(场景): 清理场景文件中的冗余属性 feat(工具): 为findClosetBulletCanDamage添加最大距离参数 chore(配置): 更新测试用的波次配置
This commit is contained in:
@@ -28,7 +28,7 @@ static func findClosetBullet(to: Vector2, fromTree: SceneTree) -> BulletBase:
|
||||
lastDistance = to.distance_to(bullet.position)
|
||||
result = bullet
|
||||
return result
|
||||
static func findClosetBulletCanDamage(to: Vector2, fromTree: SceneTree, target: EntityBase) -> BulletBase:
|
||||
static func findClosetBulletCanDamage(to: Vector2, fromTree: SceneTree, target: EntityBase, maxDistance: float = INF) -> BulletBase:
|
||||
var result: BulletBase = null
|
||||
var lastDistance = INF
|
||||
for bullet in fromTree.get_nodes_in_group("bullets"):
|
||||
@@ -36,4 +36,7 @@ static func findClosetBulletCanDamage(to: Vector2, fromTree: SceneTree, target:
|
||||
if to.distance_to(bullet.position) < lastDistance:
|
||||
lastDistance = to.distance_to(bullet.position)
|
||||
result = bullet
|
||||
if is_instance_valid(result):
|
||||
if result.position.distance_to(to) > maxDistance:
|
||||
return null
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user