void Update() { temp = clientServer.GetSessions(); if (clientServer.HasJoinedSession()) { if (count % 2 == 0) { clientServer.SendPlayerData(nick, (double)player.transform.position.x, (double)player.transform.position.y, (double)player.transform.position.z, (double)player.transform.rotation.eulerAngles.y, player.GetComponent <Animator> ().GetBool("IsWalking"), player.GetComponentInChildren <PlayerShooting> ().isShooting); } count++; } else if (clientServer.GetSessions().Count > 0) { string name = clientServer.FoundNameToNick((string)temp[0]); clientServer.JoinSession((string)temp[0]); } if (clientServer.multiplayerHandler.playerDB.Count > 0) { foreach (multi.MultiplayerHandler.PlayerData data in clientServer.multiplayerHandler.playerDB) { if (!data.IsSpawned) { Quaternion rotat = new Quaternion(); rotat.eulerAngles = new Vector3(0, (float)data.angleY, 0); GameObject tempBody = (GameObject)Instantiate(bodyPrefab, new Vector3((float)data.posX, (float)data.posY, (float)data.posZ), rotat); data.IsSpawned = true; tempBody.GetComponent <BodyScript> ().name = data.name; } } } }