Example #1
0
 public void Deserialize(SerializationBuffer buf)
 {
     AtTick         = buf.ReadInt();
     FiringPlayerId = buf.ReadInt();
     FiringRotation = buf.ReadQuaternion();
     HitCharacterId = buf.ReadInt();
 }
Example #2
0
        private void DeserializeGlobalSnapshot(SerializationBuffer buf, out int receivedTick)
        {
            receivedTick = buf.ReadInt();
            int indexForReceivedTick = GetSnapshotIndexForTick(receivedTick);

            // Commands snapshot
            int commandsCount = buf.ReadInt();

            for (int i = 0; i < commandsCount; i++)
            {
                int commandsPlayerId = buf.ReadInt();

                // Don't override commands from local players
                IdentifiedData <CMD> tmpPlayerCommands = new IdentifiedData <CMD>();
                tmpPlayerCommands.DataId = commandsPlayerId;
                tmpPlayerCommands.DataStruct.ReadFromBuffer(buf);

                for (int j = 0; j < SnapshotsRingBuffer[indexForReceivedTick].CommandsSnapshot.PlayerCommands.Count; j++)
                {
                    if (SnapshotsRingBuffer[indexForReceivedTick].CommandsSnapshot.PlayerCommands[j].DataId == commandsPlayerId)
                    {
                        SnapshotsRingBuffer[indexForReceivedTick].CommandsSnapshot.PlayerCommands[j] = tmpPlayerCommands;
                        break;
                    }
                }
            }

            // World snapshot
            SnapshotsRingBuffer[indexForReceivedTick].WorldSnapshot.ReadFromBuffer(buf);
        }
Example #3
0
 public void Deserialize(SerializationBuffer buf)
 {
     CharacterId   = buf.ReadInt();
     ForPlayerId   = buf.ReadInt();
     SpawnPosition = buf.ReadVector3();
     SpawnRotation = buf.ReadQuaternion();
 }
Example #4
0
        private void DeserializePlayerCommands(SerializationBuffer buf, ref CMD intoStruct, out int receivedTick, out int receivedPlayerId)
        {
            receivedTick     = buf.ReadInt();
            receivedPlayerId = buf.ReadInt();

            intoStruct.ReadFromBuffer(buf);
        }
        public void ReadFromBuffer(SerializationBuffer buf)
        {
            int CharacterStatesCount = buf.ReadInt();

            for (int i = 0; i < CharacterStatesCount; i++)
            {
                int characterId = buf.ReadInt();

                Vector3    position  = buf.ReadVector3();
                Quaternion rotation  = buf.ReadQuaternion();
                Vector3    velocity  = buf.ReadVector3();
                bool       isStunned = buf.ReadBool();

                // Find CharacterState corresponding to this ID and apply the state
                for (int j = 0; j < CharacterStates.Count; j++)
                {
                    if (CharacterStates[j].DataId == characterId)
                    {
                        IdentifiedData <MyCharacterState> tmpIdCharState = CharacterStates[j];

                        tmpIdCharState.DataStruct.MotorState.Position     = position;
                        tmpIdCharState.DataStruct.MotorState.Rotation     = rotation;
                        tmpIdCharState.DataStruct.MotorState.BaseVelocity = velocity;

                        tmpIdCharState.DataStruct.IsStunned = isStunned;

                        CharacterStates[j] = tmpIdCharState;
                        break;
                    }
                }
            }
        }
Example #6
0
 public void Deserialize(SerializationBuffer buf)
 {
     Add            = buf.ReadBool();
     ForLocalPlayer = buf.ReadBool();
     PlayerId       = buf.ReadInt();
     PlayerName     = buf.ReadString();
 }
Example #7
0
 public void Deserialize(SerializationBuffer buf)
 {
     Tick      = buf.ReadInt();
     Timestamp = buf.ReadInt();
 }
Example #8
0
 public void Deserialize(SerializationBuffer buf)
 {
     PlayerId      = buf.ReadInt();
     IsLocalPlayer = buf.ReadBool();
 }
Example #9
0
 public void Deserialize(SerializationBuffer buf)
 {
     Event = (EventType)buf.ReadInt();
 }
Example #10
0
 public void Deserialize(SerializationBuffer buf)
 {
     ForPlayerId = buf.ReadInt();
     ForTick     = buf.ReadInt();
 }