コード例 #1
0
    public override void Handle(SnapshotMessage message)
    {
        if (_localClient.IsConnected == false)
        {
            return;
        }

        foreach (PlayerSnapshotData playerData in message.playersData)
        {
            Player player = _playerRegistry.Players.Find(x => x.PlayerId == playerData.playerId);

            if (player == null)
            {
                _playerRegistry.RegisterPlayer(_spawner.SpawnRemotePlayer(playerData.team), playerData.playerId);
            }
            else if (player.PlayerId != _localClient.LocalPlayerId)
            {
                _playerRegistry.GetRemotePlayerById(player.PlayerId).EnqueuePosition(playerData.position, message.TickIndex);
            }
            else
            {
                _reconciler.Reconcile(message.TickIndex, playerData.position);
            }
        }

        _ball.EnqueuePosition(message.ballPosition, message.TickIndex);
    }