|
@ -46,5 +46,29 @@ namespace Multiplayer |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void QueryPosition(NetworkMessage msg) |
|
|
|
|
|
{ |
|
|
|
|
|
PlayerMsg playerMsg; |
|
|
|
|
|
if (!Utility.ReadMessage<PlayerMsg>(msg, out playerMsg)) |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
if (!ServerManager.AllPlayers.ContainsKey(playerMsg.ID)) |
|
|
|
|
|
{ |
|
|
|
|
|
Debug.Log("Recieved query from unknown player"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Player player = ServerManager.AllPlayers[playerMsg.ID]; |
|
|
|
|
|
|
|
|
|
|
|
foreach (Player otherPlayer in ServerManager.AllPlayers.Values) |
|
|
|
|
|
{ |
|
|
|
|
|
if (otherPlayer.Equals(player)) |
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
VectorMsg vectorMsg = new VectorMsg(otherPlayer.ID, otherPlayer.Position); |
|
|
|
|
|
player.Connection.Send(PlayerMsgID.Position, vectorMsg); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |