public override void Deserialize(Bitstream msg)
{
var count = msg.ReadUInt16();
count = (ushort)Math.Max((int)count, 0);
count = (ushort)Math.Min((int)count, 100);
State = new List<PlayerStateData>(count);
if (count > 0)
{
ushort objType = msg.ReadByte();
PlayerId = msg.ReadVariableUInt32();
if (_ownerType == null)
{
_ownerType = ObjectMapper.LookupType(objType);
_lookupItem = DataLookupTable.Get(_ownerType.GetTypeInfo());
}
}
NetworkObject pState = PlayerId > 0 ? ObjectMapper.GetCurrentPlayerState(PlayerId) : null;
for (int i = 0; i < count; ++i)
{
NetworkObject data = Activator.CreateInstance(_ownerType) as NetworkObject;
DataObjectPacket.ReadNetObject(_lookupItem, msg, data, pState);
pState = data;
State.Add(data as PlayerStateData);
}
if (State.Count > 0 && PlayerId > 0)
ObjectMapper.SetCurrentPlayerState(PlayerId, State.Last());
}