예제 #1
0
        public ScenarioState finishState(ScenarioState next)
        {
            ScreenState gualState = new ScreenState(this);
            // make sure this is same state
            if (!this.isSameState(next))
            {
                if (next.GetType().Equals(this.GetType()))
                {
                    ScreenState nextState = (ScreenState)next;

                    // make gualState's start be the earlier of the two
                    if (nextState._start.CompareTo(gualState._start) < 0)
                    {
                        gualState._start = nextState._start;
                    }
                    // make gualState's start be the later of the two
                    if (nextState._end.CompareTo(gualState._end) > 0)
                    {
                        gualState._end = nextState._end;
                    }
                }
            }
            return gualState;
        }
예제 #2
0
        public void processSkeleton(Skeleton skeleton)
        {
            if (skeleton != null)
            {
                Boolean rightArmStraight = this._straightArmIndicator.isRightArmStraight(skeleton, false);
                Boolean rightArmUp = this._straightArmIndicator.rightArmUp(skeleton);

                ScreenState state;
                double curX = skeleton.Joints[JointType.HandRight].Position.X;
                double curY = skeleton.Joints[JointType.HandRight].Position.Y;
                if (rightArmStraight && rightArmUp && !pullInitiated)
                {
                    state = new ScreenState(ScreenState.ScreenPosition.ARM_STRAIGHTUP, DateTime.Now, DateTime.Now);
                    this._rightHandHistory.addState(state);
                    startX = curX;
                    startY = curY;

                    lastX = startX;
                    lastY = startY;

                    endY = startY - (skeleton.Joints[JointType.ShoulderCenter].Position.Y - skeleton.Joints[JointType.HipCenter].Position.Y);
                    double x = startY - endY;
                    //Console.WriteLine("The distance b/w shoulder center and hip center is :" + x);
                    //Console.WriteLine("startY " + startY + ", endY: " + endY);

                    pullInitiated = true;
                }
                else if (pullInitiated)
                {
                    if (Math.Abs(curX - startX) < allowanceX && (curY < lastY))
                    {
                        //Console.WriteLine("WOO! curY: " + curY + ", lastY: " + lastY);
                        if (curY <= endY) //they went far down enough!
                        {
                            //Console.WriteLine("woo!");
                            state = new ScreenState(ScreenState.ScreenPosition.ARM_DOWN, DateTime.Now, DateTime.Now);
                            this._rightHandHistory.addState(state);
                        }
                        else
                        {
                            //Console.WriteLine("On the way down...");
                            state = new ScreenState(ScreenState.ScreenPosition.ARM_MOVINGDOWN, DateTime.Now, DateTime.Now);
                            this._rightHandHistory.addState(state);
                        }
                        lastX = curX;
                        lastY = curY;
                    }
                    else //they didn't go down straight enough or they went up!
                    {
                        state = new ScreenState(ScreenState.ScreenPosition.ARM_ELSEWHERE, DateTime.Now, DateTime.Now);
                        this._rightHandHistory.addState(state);
                        startX = -1;
                        lastX = -1;
                        startY = -1;
                        lastY = -1;
                        endY = -1;
                        pullInitiated = false;

                    }

                }
                else
                {
                    state = new ScreenState(ScreenState.ScreenPosition.ARM_ELSEWHERE, DateTime.Now, DateTime.Now);
                    this._rightHandHistory.addState(state);
                    pullInitiated = false;
                }
            }
        }
예제 #3
0
 public ScreenState(ScreenState goalState)
 {
     this._start = goalState._start;
     this._end = goalState._end;
     this._pos = goalState._pos;
 }