diff options
author | chai <chaifix@163.com> | 2021-01-01 09:44:26 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-01-01 09:44:26 +0800 |
commit | be6caf20c319f55fe6fa5d918859af39991a899f (patch) | |
tree | 795cbdfd4eea3c442f5578ff0538ad63dfae0725 /Client/Assembly-CSharp/AmongUsClient.cs | |
parent | e9ea621b93fbb58d9edfca8375918791637bbd52 (diff) |
*网络
Diffstat (limited to 'Client/Assembly-CSharp/AmongUsClient.cs')
-rw-r--r-- | Client/Assembly-CSharp/AmongUsClient.cs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Client/Assembly-CSharp/AmongUsClient.cs b/Client/Assembly-CSharp/AmongUsClient.cs index 5726992..f417c16 100644 --- a/Client/Assembly-CSharp/AmongUsClient.cs +++ b/Client/Assembly-CSharp/AmongUsClient.cs @@ -118,6 +118,7 @@ public class AmongUsClient : InnerNetClient base.StartCoroutine(this.CoStartGame()); } + // 收到开始游戏的消息后开始游戏 private IEnumerator CoStartGame() { yield return null; @@ -286,13 +287,14 @@ public class AmongUsClient : InnerNetClient yield break; } + // 加入游戏回调 protected override void OnPlayerJoined(ClientData data) { if (DestroyableSingleton<GameStartManager>.InstanceExists) { DestroyableSingleton<GameStartManager>.Instance.ResetStartState(); } - if (base.AmHost && data.InScene) + if (base.AmHost && data.InScene) // 如果本机是Local host { this.CreatePlayer(data); } @@ -459,6 +461,7 @@ public class AmongUsClient : InnerNetClient { v = new Vector2(-1.9f, 3.25f); } + // 新建player gameobject Debug.Log(string.Format("Spawned player {0} for client {1}", availableId, clientData.Id)); PlayerControl playerControl = UnityEngine.Object.Instantiate<PlayerControl>(this.PlayerPrefab, v, Quaternion.identity); playerControl.PlayerId = (byte)availableId; @@ -469,6 +472,7 @@ public class AmongUsClient : InnerNetClient { PlayerControl.GameOptions.SetRecommendations(GameData.Instance.PlayerCount, AmongUsClient.Instance.GameMode); } + // 同步这个新玩家的单局配置,调用它的设置函数 playerControl.RpcSyncSettings(PlayerControl.GameOptions); } |