1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-31 00:11:54 +08:00

feat(战斗系统): 添加KukeMC召唤机制及子实体管理

为KukeMC添加召唤子实体KukeChild的功能,并在血量低于25%时自动清除所有子实体并恢复血量
在EntityBase中添加tryKill方法统一处理实体销毁逻辑
在EntityTool中添加按类查找实体的工具方法
This commit is contained in:
2025-09-19 22:11:29 +08:00
parent 020f268c5f
commit ec795e534e
4 changed files with 28 additions and 3 deletions
+7
View File
@@ -24,3 +24,10 @@ static func findClosetEntity(to: Vector2, fromTree: SceneTree, player: bool = fa
return result
static func findClosetPlayer(to: Vector2, fromTree: SceneTree, excludes: Array[EntityBase] = []) -> EntityBase:
return findClosetEntity(to, fromTree, true, false, excludes)
static func findEntityByClass(cls: String, fromTree: SceneTree) -> Array[EntityBase]:
var results: Array[EntityBase] = []
var nodes = fromTree.get_nodes_in_group("mobs") + fromTree.get_nodes_in_group("players")
for entity in nodes:
if entity.get_class() == cls:
results.append(entity)
return results