Lidgren.Network.NetIncomingMessage.ReadDouble C# (CSharp) 메소드

ReadDouble() 공개 메소드

Reads a 64 bit floating point value written using Write(Double)
public ReadDouble ( ) : double
리턴 double
        public double ReadDouble()
        {
            NetException.Assert(m_bitLength - m_readPosition >= 64, c_readOverflowError);

            if ((m_readPosition & 7) == 0) // read directly
            {
                // read directly
                double retval = BitConverter.ToDouble(m_data, m_readPosition >> 3);
                m_readPosition += 64;
                return retval;
            }

            byte[] bytes = ReadBytes(8);
            return BitConverter.ToDouble(bytes, 0); // endianness is handled inside BitConverter.ToSingle
        }

Usage Example

 public void Decode(NetIncomingMessage im)
 {
     this.Id = im.ReadInt32();
     this.MessageTime = im.ReadDouble();
     this.Health = im.ReadFloat();
     this.MaxHealth = im.ReadFloat();
 }
All Usage Examples Of Lidgren.Network.NetIncomingMessage::ReadDouble