private void OnConnect(Networking.NetworkPlayer obj) { if (!obj.IsSelf) { return; } InitSelf(obj.Player); }
private Player CreatePlayerObject(Networking.NetworkPlayer netPlayer) { var player = GameObject.Instantiate <Player>(PlayerPrefab); player.Initialize(netPlayer, LocalInputGrabber, ConnectionManager.connectionMode == ConnectionMode.SERVER); Spawner.Spawn(player); return(player); }
private void OnPlayerDisconnect(Networking.NetworkPlayer player) { var go = NetworkToGameMap[player]; NetworkToGameMap.Remove(player); GameObject.Destroy(go); Debug.Log("OnPlayerDisconnect Player #" + player.ID + "(" + player.Name + ")"); }
private void OnPlayerConnect(Networking.NetworkPlayer netPlayer) { //var go = GameObject.CreatePrimitive(PrimitiveType.Sphere); //go.name = "Player_" + player.Name; Player player = CreatePlayerObject(netPlayer); NetworkToGameMap.Add(netPlayer, player); Debug.Log("OnPlayerConnect Player #" + netPlayer.ID + "(" + netPlayer.Name + ")"); }