void OnReceivedClientInput(NetworkDataMessage message)
        {
            if (ReceivedInputs == null)
            {
                return;
            }
            var inputSet = message.ReadAs <InputSetMessage>();

            ReceivedInputs(message.Connection.Id,
                           inputSet.StartTimestamp,
                           inputSet.Inputs.GetSlice(inputSet.InputCount));
        }
Beispiel #2
0
        void OnReceivedClientInput(NetworkDataMessage message)
        {
            NetworkClientPlayer client;

            if (!clients.TryGetValue(message.Connection, out client))
            {
                return;
            }
            var inputSet = message.ReadAs <InputSetMessage>();

            InvokeRecievedInputs(client.PlayerID, inputSet.StartTimestamp,
                                 inputSet.AsArraySegment());
        }
Beispiel #3
0
        void OnClientReady(NetworkDataMessage dataMsg)
        {
            NetworkClientPlayer client;

            if (!clients.TryGetValue(dataMsg.Connection, out client))
            {
                return;
            }
            var message = dataMsg.ReadAs <PeerReadyMessage>();

            client.IsReady = message.IsReady;
            InvokePlayerUpdated(client);
        }
        void OnClientConfigUpdated(NetworkDataMessage dataMsg)
        {
            NetworkClientPlayer client;

            if (!clients.TryGetValue(dataMsg.Connection.Id, out client))
            {
                return;
            }
            var message = dataMsg.ReadAs <ClientUpdateConfigMessage>();

            client.Config          = message.PlayerConfig;
            client.Config.PlayerID = client.PlayerID;
            PlayerUpdated?.Invoke(client);
        }