public PlayerProjectileAttack Copy()
        {
            PlayerProjectileAttack playerProjectileAttack = Pool.Get <PlayerProjectileAttack>();

            this.CopyTo(playerProjectileAttack);
            return(playerProjectileAttack);
        }
        public static PlayerProjectileAttack Deserialize(Stream stream)
        {
            PlayerProjectileAttack playerProjectileAttack = Pool.Get <PlayerProjectileAttack>();

            PlayerProjectileAttack.Deserialize(stream, playerProjectileAttack, false);
            return(playerProjectileAttack);
        }
        public static void Serialize(Stream stream, PlayerProjectileAttack instance)
        {
            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.Serialize(memoryStream, instance.playerAttack);
            uint length = (uint)memoryStream.Length;

            ProtocolParser.WriteUInt32(stream, length);
            stream.Write(memoryStream.GetBuffer(), 0, (int)length);
            stream.WriteByte(18);
            memoryStream.SetLength((long)0);
            Vector3Serialized.Serialize(memoryStream, instance.hitVelocity);
            uint num = (uint)memoryStream.Length;

            ProtocolParser.WriteUInt32(stream, num);
            stream.Write(memoryStream.GetBuffer(), 0, (int)num);
            stream.WriteByte(29);
            ProtocolParser.WriteSingle(stream, instance.hitDistance);
            stream.WriteByte(37);
            ProtocolParser.WriteSingle(stream, instance.travelTime);
            Pool.FreeMemoryStream(ref memoryStream);
        }
        public static PlayerProjectileAttack DeserializeLength(Stream stream, int length)
        {
            PlayerProjectileAttack playerProjectileAttack = Pool.Get <PlayerProjectileAttack>();

            PlayerProjectileAttack.DeserializeLength(stream, length, playerProjectileAttack, false);
            return(playerProjectileAttack);
        }
 public static PlayerProjectileAttack Deserialize(byte[] buffer, PlayerProjectileAttack instance, bool isDelta = false)
 {
     using (MemoryStream memoryStream = new MemoryStream(buffer))
     {
         PlayerProjectileAttack.Deserialize(memoryStream, instance, isDelta);
     }
     return(instance);
 }
 public virtual void WriteToStreamDelta(Stream stream, PlayerProjectileAttack previous)
 {
     if (previous == null)
     {
         PlayerProjectileAttack.Serialize(stream, this);
         return;
     }
     PlayerProjectileAttack.SerializeDelta(stream, this, previous);
 }
 public static byte[] SerializeToBytes(PlayerProjectileAttack instance)
 {
     byte[] array;
     using (MemoryStream memoryStream = new MemoryStream())
     {
         PlayerProjectileAttack.Serialize(memoryStream, instance);
         array = memoryStream.ToArray();
     }
     return(array);
 }
        public static PlayerProjectileAttack Deserialize(byte[] buffer)
        {
            PlayerProjectileAttack playerProjectileAttack = Pool.Get <PlayerProjectileAttack>();

            using (MemoryStream memoryStream = new MemoryStream(buffer))
            {
                PlayerProjectileAttack.Deserialize(memoryStream, playerProjectileAttack, false);
            }
            return(playerProjectileAttack);
        }
 public static PlayerProjectileAttack Deserialize(Stream stream, PlayerProjectileAttack instance, bool isDelta)
 {
     while (true)
     {
         int num = stream.ReadByte();
         if (num == -1)
         {
             break;
         }
         if (num <= 18)
         {
             if (num != 10)
             {
                 if (num == 18)
                 {
                     Vector3Serialized.DeserializeLengthDelimited(stream, ref instance.hitVelocity, isDelta);
                     continue;
                 }
             }
             else if (instance.playerAttack != null)
             {
                 PlayerAttack.DeserializeLengthDelimited(stream, instance.playerAttack, isDelta);
                 continue;
             }
             else
             {
                 instance.playerAttack = PlayerAttack.DeserializeLengthDelimited(stream);
                 continue;
             }
         }
         else if (num == 29)
         {
             instance.hitDistance = ProtocolParser.ReadSingle(stream);
             continue;
         }
         else if (num == 37)
         {
             instance.travelTime = ProtocolParser.ReadSingle(stream);
             continue;
         }
         Key key = ProtocolParser.ReadKey((byte)num, stream);
         if (key.Field == 0)
         {
             throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
         }
         ProtocolParser.SkipKey(stream, key);
     }
     return(instance);
 }
 public static void ResetToPool(PlayerProjectileAttack instance)
 {
     if (!instance.ShouldPool)
     {
         return;
     }
     if (instance.playerAttack != null)
     {
         instance.playerAttack.ResetToPool();
         instance.playerAttack = null;
     }
     instance.hitVelocity = new Vector3();
     instance.hitDistance = 0f;
     instance.travelTime  = 0f;
     Pool.Free <PlayerProjectileAttack>(ref instance);
 }
 public void CopyTo(PlayerProjectileAttack instance)
 {
     if (this.playerAttack == null)
     {
         instance.playerAttack = null;
     }
     else if (instance.playerAttack != null)
     {
         this.playerAttack.CopyTo(instance.playerAttack);
     }
     else
     {
         instance.playerAttack = this.playerAttack.Copy();
     }
     instance.hitVelocity = this.hitVelocity;
     instance.hitDistance = this.hitDistance;
     instance.travelTime  = this.travelTime;
 }
 public virtual void ReadFromStream(Stream stream, int size, bool isDelta = false)
 {
     PlayerProjectileAttack.DeserializeLength(stream, size, this, isDelta);
 }
 public void ResetToPool()
 {
     PlayerProjectileAttack.ResetToPool(this);
 }
 public virtual void WriteToStream(Stream stream)
 {
     PlayerProjectileAttack.Serialize(stream, this);
 }
 public byte[] ToProtoBytes()
 {
     return(PlayerProjectileAttack.SerializeToBytes(this));
 }
 public void ToProto(Stream stream)
 {
     PlayerProjectileAttack.Serialize(stream, this);
 }
 public void FromProto(Stream stream, bool isDelta = false)
 {
     PlayerProjectileAttack.Deserialize(stream, this, isDelta);
 }
 public static void SerializeLengthDelimited(Stream stream, PlayerProjectileAttack instance)
 {
     byte[] bytes = PlayerProjectileAttack.SerializeToBytes(instance);
     ProtocolParser.WriteUInt32(stream, (uint)bytes.Length);
     stream.Write(bytes, 0, (int)bytes.Length);
 }