public UpdateCommand(IList <Helmet> existingHelmets, TrackingPackage package, ObjectPool helmetsPool)
 {
     m_pkg          = package;
     m_helmetsPool  = helmetsPool;
     m_helmets      = existingHelmets;
     m_addedHelmets = new Stack <Helmet>();
     m_oldColors    = new Stack <Color>();
 }
Example #2
0
        public override int Parse(byte[] data, int startIdx, out IPackage result)
        {
            result = null;
            if ((PackageType)data[startIdx] != PackageType.TrackingPackage)
            {
                return(m_successor?.Parse(data, startIdx, out result) ?? 0);
            }
            int readBytes = TrackingPackage.Parse(data, startIdx, out TrackingPackage trackingPackage);

            Convert(ref trackingPackage);
            result = trackingPackage;
            return(readBytes);
        }
Example #3
0
 private void Convert(ref TrackingPackage pkg)
 {
     for (int trackIdx = 0; trackIdx < pkg.Tracks.Count; ++trackIdx)
     {
         Vector3    trackPos = pkg.Tracks[trackIdx].position;
         Quaternion trackRot = pkg.Tracks[trackIdx].rotation;
         m_converter.Convert(ref trackPos, ref trackRot);
         var unit = new TrackingPackage.TrackingUnit()
         {
             position = trackPos,
             rotation = trackRot,
             id       = pkg.Tracks[trackIdx].id,
             color    = pkg.Tracks[trackIdx].color,
         };
         pkg.Tracks[trackIdx] = unit;
     }
 }