summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/AmongUsClient.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assembly-CSharp/AmongUsClient.cs')
-rw-r--r--Client/Assembly-CSharp/AmongUsClient.cs6
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);
}