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

feat(多人游戏): 添加玩家名称存储并优化多人游戏逻辑

在MultiplayerState中添加playerName静态变量用于存储玩家名称
修改Starter.gd中的startMultiplayerGame方法,保存玩家名称到MultiplayerState
优化EntityBase.gd的AI逻辑,仅当玩家名称匹配时才执行AI
移除不再需要的多人游戏同步方法
This commit is contained in:
2025-11-11 22:23:36 +08:00
parent 40923cdd42
commit bdc9201dba
3 changed files with 11 additions and 22 deletions
+5 -5
View File
@@ -53,11 +53,11 @@ func rebuildAllPlayers(playerNames: Array[String]):
addPlayerName(i)
@rpc("any_peer")
func startMultiplayerGame():
if multiplayer.is_server():
for i in getPlayerNames():
EntityBase.generatePlayer(i)
Wave.next()
UIState.closeCurrentPanel()
MultiplayerState.playerName = playerNameInput.text
for i in getPlayerNames():
EntityBase.generatePlayer(i)
Wave.next()
UIState.closeCurrentPanel()
func _ready():
historyStack = Composables.useHistoryStack(playerNameInput)