1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-27 14:02:29 +08:00

feat(多人游戏): 添加多人游戏生成器功能

- 在World场景中添加MultiplayerSpawner节点
- 在WorldManager中实现spawn方法处理本地和多人游戏生成逻辑
- 移除EntityBase中不再需要的多人游戏同步代码
This commit is contained in:
2025-11-14 06:45:54 +08:00
parent 12191f4233
commit 9e0b713ef7
3 changed files with 14 additions and 11 deletions
+10
View File
@@ -5,10 +5,12 @@ static var rootNode: WorldManager
static var tree: SceneTree
static var runningTime: int = 0
static var peer: ENetMultiplayerPeer
static var spawner: MultiplayerSpawner
func _ready():
tree = get_tree()
rootNode = self
spawner = $%spawner
ComponentManager.init()
func _physics_process(delta):
runningTime += delta * 1000
@@ -24,6 +26,14 @@ func spawnWave():
nextWave(waves)
if MultiplayerState.isMultiplayer and multiplayer.is_server():
nextWave.rpc(waves)
func spawn(node: Node):
if MultiplayerState.isMultiplayer:
if multiplayer.is_server():
spawner.spawn(node)
else:
add_child(node)
static func getTime():
return runningTime
static func spawnNode(node: Node):
rootNode.spawn(node)