public virtual void WriteToStreamDelta(Stream stream, PlayerAttack previous)
 {
     if (previous == null)
     {
         PlayerAttack.Serialize(stream, this);
         return;
     }
     PlayerAttack.SerializeDelta(stream, this, previous);
 }
        public static void SerializeDelta(Stream stream, PlayerProjectileAttack instance, PlayerProjectileAttack previous)
        {
            MemoryStream memoryStream = Pool.Get <MemoryStream>();

            if (instance.playerAttack == null)
            {
                throw new ArgumentNullException("playerAttack", "Required by proto specification.");
            }
            stream.WriteByte(10);
            memoryStream.SetLength((long)0);
            PlayerAttack.SerializeDelta(memoryStream, instance.playerAttack, previous.playerAttack);
            uint length = (uint)memoryStream.Length;

            ProtocolParser.WriteUInt32(stream, length);
            stream.Write(memoryStream.GetBuffer(), 0, (int)length);
            if (instance.hitVelocity != previous.hitVelocity)
            {
                stream.WriteByte(18);
                memoryStream.SetLength((long)0);
                Vector3Serialized.SerializeDelta(memoryStream, instance.hitVelocity, previous.hitVelocity);
                uint num = (uint)memoryStream.Length;
                ProtocolParser.WriteUInt32(stream, num);
                stream.Write(memoryStream.GetBuffer(), 0, (int)num);
            }
            if (instance.hitDistance != previous.hitDistance)
            {
                stream.WriteByte(29);
                ProtocolParser.WriteSingle(stream, instance.hitDistance);
            }
            if (instance.travelTime != previous.travelTime)
            {
                stream.WriteByte(37);
                ProtocolParser.WriteSingle(stream, instance.travelTime);
            }
            Pool.FreeMemoryStream(ref memoryStream);
        }