private void Disconnect() { AccountHandler.SignOut(id); player = null; tcp.Disconnect(); udp.Disconnect(); }
public static void PlayerRot(ClientData.Position pos) { using (Packet _packet = new Packet((int)ServerPackets.playerRot)) { _packet.Write(pos.id); _packet.Write(pos.rotation); SendUDPDataToAll(pos.id, _packet); } }
public static void PositionBroadcast(int _toClient, ClientData.Position pos) { using (Packet _packet = new Packet((int)ServerPackets.spawnPlayer)) { _packet.Write(pos.id); _packet.Write(pos.username); _packet.Write(pos.position); _packet.Write(pos.rotation); //SendTCPData(_toClient, _packet); SendTCPDataToAll(_toClient, _packet); } }
public void SendtoGame(string uname) { player = new ClientData.Position(id, uname, new Vector3(0, 0, 0)); foreach (Client client in Server.clients.Values) { if (client.player != null) { if (client.id != id) { ServerSend.PositionBroadcast(id, client.player); } } } foreach (Client client in Server.clients.Values) { if (client.player != null) { ServerSend.PositionBroadcast(client.id, player); } } }