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;
                    }
                }
            }
        }
Beispiel #2
0
 public void Deserialize(SerializationBuffer buf)
 {
     CharacterId   = buf.ReadInt();
     ForPlayerId   = buf.ReadInt();
     SpawnPosition = buf.ReadVector3();
     SpawnRotation = buf.ReadQuaternion();
 }