예제 #1
0
        private void ReceiveAllPlayers(NetIncomingMessage inc)
        {
            var count = inc.ReadInt32();

            for (int n = 0; n < count; n++)
            {
                var player = new Player();
                inc.ReadAllProperties(player);
                if (player.Name == Player.Name)
                {
                    continue;
                }
                if (OtherPlayers.Any(p => p.Name == player.Name))
                {
                    var oldPlayer = OtherPlayers.FirstOrDefault(p => p.Name == player.Name);
                    oldPlayer._position.X = player._position.X;
                    oldPlayer._position.Y = player._position.Y;
                }
                else
                {
                    OtherPlayers.Add(player);
                }
            }
        }