mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
refactor(wave): 重构波次生成逻辑以支持多人游戏
将波次生成逻辑拆分为数据准备和实体生成两个阶段,便于多人游戏同步 修改 Wave 类以支持实例数据复制 更新相关调用点使用新的波次生成方式
This commit is contained in:
@@ -12,10 +12,18 @@ func _ready():
|
||||
ComponentManager.init()
|
||||
func _physics_process(delta):
|
||||
runningTime += delta * 1000
|
||||
if multiplayer.is_server() or not MultiplayerState.isMultiplayer:
|
||||
if EntityBase.mobCount() == 0 and runningTime > 3000:
|
||||
Wave.next()
|
||||
UIState.setPanel("MakeFeed")
|
||||
if EntityBase.mobCount() == 0 and runningTime > 1000:
|
||||
UIState.setPanel("MakeFeed")
|
||||
|
||||
@rpc("authority")
|
||||
func nextWave(waves: Array[Wave]):
|
||||
Wave.next(waves)
|
||||
|
||||
func spawnWave():
|
||||
var waves = Wave.spawn()
|
||||
nextWave(waves)
|
||||
if MultiplayerState.isMultiplayer and multiplayer.is_server():
|
||||
nextWave.rpc(waves)
|
||||
|
||||
static func getTime():
|
||||
return runningTime
|
||||
|
||||
Reference in New Issue
Block a user