Пример #1
0
 protected override void Awake()
 {
     base.Awake();
     customSkillActionLogic = new CustomSkillActionLogic(this);
     customBody             = new CustomBody(this);
     //CacheCapsuleCollider.isTrigger = true;
 }
Пример #2
0
 /// <summary>
 ///     Create a new Document
 /// </summary>
 /// <param name='operations'>
 ///     Reference to the DocumentDBRestAPIClient.IDocumentDbConnector.
 /// </param>
 /// <param name='ridDB'>
 ///     Required. The Database Id
 /// </param>
 /// <param name='ridColl'>
 ///     Required. The Collection Id
 /// </param>
 /// <param name='request'>
 ///     Required.
 /// </param>
 /// <param name='authorization'>
 ///     Required. The authentication type and signature token. Both master
 ///     key and resource tokens are allowed for  operation.
 ///     <c>type={typeoftoken}%26ver={tokenversion}%26sig={hashsignature}</c>
 /// </param>
 /// <param name='userAgent'>
 ///     Required. Optional. The string of client user agent performing the
 ///     request.
 /// </param>
 /// <param name='xMSDate'>
 ///     Required. The date of the request The date is expressed in
 ///     Coordinated Universal Time format.
 ///     <example>
 ///         Fri, 08 Apr 2015
 ///         03:52:31 GMT
 ///     </example>
 /// </param>
 /// <param name='xMSVersion'>
 ///     Required. The version of DocumentDB REST service. The latest
 ///     version is used when the header is not provided use
 ///     <c>2015-08-06</c>
 /// </param>
 public static Document CreateDocument(IDocumentDbConnector operations, string ridDB, string ridColl,
                                       CustomBody request, string authorization, string userAgent, string xMSDate, string xMSVersion)
 {
     return
         (Task.Factory.StartNew(
              s => ((IDocumentDbConnector)s).CreateDocumentAsync(ridDB, ridColl, request, authorization,
                                                                 userAgent, xMSDate, xMSVersion), operations, CancellationToken.None, TaskCreationOptions.None,
              TaskScheduler.Default)
          .Unwrap()
          .GetAwaiter()
          .GetResult());
 }
Пример #3
0
        protected static CustomBody CreateBodyFromReader(BinaryReader reader, Version version)
        {
            CustomBody body = new CustomBody();

            try
            {
                body.IsTracked = reader.ReadBoolean();

                if (body.IsTracked)
                {
                    #region Old Version
                    if (version < v02)
                    {
                        int count;
                        count = reader.ReadInt32(); // Activities.Count
                        for (int i = 0; i < count; i++)
                        {
                            reader.ReadInt32();     // key
                            reader.ReadInt32();     // value
                        }
                        count = reader.ReadInt32(); // Appearance.Count
                        for (int i = 0; i < count; i++)
                        {
                            reader.ReadInt32(); // key
                            reader.ReadInt32(); // value
                        }
                    }
                    #endregion

                    body.ClippedEdges = (FrameEdges)reader.ReadInt32();

                    #region Old Version
                    if (version < v02)
                    {
                        reader.ReadInt32();         // Engaged
                        int count;
                        count = reader.ReadInt32(); // Expressions.Count
                        for (int i = 0; i < count; i++)
                        {
                            reader.ReadInt32(); // key
                            reader.ReadInt32(); // value
                        }
                    }
                    #endregion

                    body.HandLeftConfidence  = (TrackingConfidence)reader.ReadInt32();
                    body.HandLeftState       = (HandState)reader.ReadInt32();
                    body.HandRightConfidence = (TrackingConfidence)reader.ReadInt32();
                    body.HandRightState      = (HandState)reader.ReadInt32();
                    body.IsRestricted        = reader.ReadBoolean();

                    int orientationCount = reader.ReadInt32();
                    for (var i = 0; i < orientationCount; i++)
                    {
                        var key   = (JointType)reader.ReadInt32();
                        var value = new JointOrientation();
                        value.JointType = (JointType)reader.ReadInt32();
                        var vector = new Vector4();
                        vector.W          = reader.ReadSingle();
                        vector.X          = reader.ReadSingle();
                        vector.Y          = reader.ReadSingle();
                        vector.Z          = reader.ReadSingle();
                        value.Orientation = vector;
                        var dict = body.JointOrientations as IDictionary <JointType, JointOrientation>;
                        if (dict != null)
                        {
                            dict[key] = value;
                        }
                    }

                    int jointCount = reader.ReadInt32();
                    for (var i = 0; i < jointCount; i++)
                    {
                        var key   = (JointType)reader.ReadInt32();
                        var value = new CustomJoint(key);
                        value.JointType = (JointType)reader.ReadInt32();
                        var position = new CameraSpacePoint();
                        position.X     = reader.ReadSingle();
                        position.Y     = reader.ReadSingle();
                        position.Z     = reader.ReadSingle();
                        value.Position = position;

                        if (version > v03)
                        {
                            var depthPosition = new DepthSpacePoint();
                            depthPosition.X     = reader.ReadSingle();
                            depthPosition.Y     = reader.ReadSingle();
                            value.DepthPosition = depthPosition;
                            var colorPosition = new ColorSpacePoint();
                            colorPosition.X     = reader.ReadSingle();
                            colorPosition.Y     = reader.ReadSingle();
                            value.ColorPosition = colorPosition;
                        }

                        value.TrackingState = (TrackingState)reader.ReadInt32();
                        var dict = body.Joints as IDictionary <JointType, IJoint>;
                        if (dict != null)
                        {
                            dict[key] = value;
                        }
                    }

#if NETFX_CORE
                    var lean = new Point();
#else
                    var lean = new PointF();
#endif
                    lean.X    = reader.ReadSingle();
                    lean.Y    = reader.ReadSingle();
                    body.Lean = lean;

                    body.LeanTrackingState = (TrackingState)reader.ReadInt32();
                    body.TrackingId        = reader.ReadUInt64();

                    if (version > v03)
                    {
                        body.HasMappedDepthPositions = reader.ReadBoolean();
                        body.HasMappedColorPositions = reader.ReadBoolean();
                    }
                }
            }
            catch (Exception ex)
            {
                // TODO: Log This
                System.Diagnostics.Debug.WriteLine(ex);
            }

            return(body);
        }