Esempio n. 1
0
    /// <summary>
    /// First call per frame checks if there is a new skeleton frame and updates,
    /// returns true if there is new data
    /// Subsequent calls do nothing have the same return as the first call.
    /// </summary>
    /// <returns>
    /// A <see cref="System.Boolean"/>
    /// </returns>
    public bool pollSkeleton()
    {
        if (!updatedSkeleton)
        {
            updatedSkeleton = true;

            /*if (kinect.pollSkeleton())
             * {
             *      newSkeleton = true;
             *      System.Int64 cur = kinect.getSkeleton().liTimeStamp;
             *      System.Int64 diff = cur - ticks;
             *      ticks = cur;
             *      deltaTime = diff / (float)1000;
             *      processSkeleton();
             * }*/

            //Felix
            if ((kinect.pollSkeleton() && (Player == null || !Player.Replaying)) ||
                (Player != null && Player.Replaying && (Player.FrameCount != 0)))
            {
                newSkeleton = true;
                System.Int64 cur  = kinect.getSkeleton().liTimeStamp;
                System.Int64 diff = cur - ticks;
                ticks     = cur;
                deltaTime = diff / (float)1000;
                processSkeletonFromFrame(Player != null && Player.Replaying && Player.FrameCount != 0
                            ? (NuiSkeletonFrame)Player.GetCurrentFrame()
                            : kinect.getSkeleton());
            }
            //If no kinect is connected and no replay is running, hide assets
            else
            {
                if (Player != null && Player.Focus)
                {
                    Player.SetFocus(false);
                }
            }
        }
        return(newSkeleton);
    }