1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-08 12:47:13 +08:00

refactor(Statemachine): 优化实体和物品掉落管理逻辑

重构 EntityBase 的 mobCount 方法为 getMobs 以返回完整列表
在 WorldManager 中添加 canNextWave 方法检查怪物和可收集物品
优化 ItemDropped 的玩家查找和收集条件判断逻辑
This commit is contained in:
2025-12-14 14:07:29 +08:00
parent 7168c690f3
commit c0d5faf668
3 changed files with 25 additions and 7 deletions
+3 -2
View File
@@ -15,13 +15,15 @@ func _ready():
spawner.spawn_function = justReturn
func _physics_process(delta):
runningTime += delta * 1000
if EntityBase.mobCount() == 0 and runningTime > 1000:
if canNextWave() and runningTime > 1000:
UIState.setPanel("MakeFeed")
@rpc("authority")
func nextWave(waves: Array):
Wave.next(waves)
func canNextWave():
return len(EntityBase.getMobs()) == 0 and len(ItemDropped.getDropsCanCollet()) == 0
func spawnWave():
var waves = Wave.spawn()
nextWave(waves)
@@ -34,7 +36,6 @@ func spawn(node: Node):
else:
add_child(node)
func justReturn(data):
print(ArrayTool.parseEncodedObject(data))
return ArrayTool.parseEncodedObject(data)[0]
static func getTime():