Ejemplo n.º 1
0
        private FVector AsVector(VectorType type)
        {
            _reader.Reset();

            FVector tVector = null;

            switch (type)
            {
            case VectorType.Normal:
                tVector = _reader.SerializePropertyVectorNormal();
                break;

            case VectorType.Vector10:
                tVector = _reader.SerializePropertyVector10();
                break;

            case VectorType.Vector100:
                tVector = _reader.SerializePropertyVector100();
                break;

            case VectorType.Quantize:
                tVector = _reader.SerializePropertyQuantizeVector();
                break;
            }

            if (_reader.IsError || !_reader.AtEnd())
            {
                return(null);
            }

            return(tVector);
        }
        public void Serialize(NetBitReader reader)
        {
            return;

            bool[] flags = reader.ReadBits(7);

            BlockingHit      = flags[6];
            StartPenetrating = flags[5];
            bool impactPointEqualsLocation = flags[4];
            bool impactNormalEqualsNormal  = flags[3];
            bool invalidItem        = flags[2];
            bool invalidFaceIndex   = flags[1];
            bool noPenetrationDepth = flags[0];

            Time     = reader.ReadSingle();
            Location = reader.SerializePropertyQuantizeVector();
            Normal   = reader.SerializePropertyVectorNormal();

            if (!impactPointEqualsLocation)
            {
                ImpactPoint = reader.SerializePropertyQuantizeVector();
            }
            else
            {
                ImpactPoint = Location;
            }

            if (!impactNormalEqualsNormal)
            {
                ImpactNormal = reader.SerializePropertyVectorNormal();
            }
            else
            {
                ImpactNormal = Normal;
            }

            TraceStart = reader.SerializePropertyQuantizeVector();
            TraceEnd   = reader.SerializePropertyQuantizeVector();

            if (!noPenetrationDepth)
            {
                PenetrationDepth = reader.SerializePropertyFloat();
            }
            else
            {
                PenetrationDepth = 0;
            }

            Distance = (ImpactPoint - TraceStart).Size();

            if (!invalidItem)
            {
                Item = reader.ReadBitsToInt(32);
            }
            else
            {
                Item = -1;
            }

            PhysMaterial = reader.SerializePropertyUInt16();
            Actor        = reader.SerializePropertyUInt16();
            Component    = reader.SerializePropertyUInt16();
            BoneName     = reader.ReadFString();

            if (!invalidFaceIndex)
            {
                FaceIndex = reader.ReadBitsToInt(32);
            }
            else
            {
                FaceIndex = -1;
            }
        }