コード例 #1
0
        // add isGhost!
        public Person(SkeletonWrapper skeletonData, Color c, bool isGhost)
        {
            hashCode = HASH_CODE;
            HASH_CODE += 1;

            this.skeletonData = skeletonData;
            this.isGhost = isGhost;

            // Retrieve hand data.
            Joint rightHand = skeletonData.getRightHandJoint();
            Joint leftHand = skeletonData.getLeftHandJoint();

            // Retrieve torso data.
            if (isGhost == false)
            {
                Joint shoulderCenter = skeletonData.getCenterShoulderJoint();
                Joint spine = skeletonData.getSpineJoint();

                torsoTop = shoulderCenter.Position;
                torsoBottom = spine.Position;
            }

            leftHandPosition = leftHand.Position;
            rightHandPosition = rightHand.Position;

            this.color = c;

            canSpawnBoids = true;

            this.rightHand = new Hand(rightHand);
            this.leftHand = new Hand(leftHand);
        }
コード例 #2
0
ファイル: Game1.cs プロジェクト: verweij/battleships
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        /// 
        void ProcSide(DepthImagePoint hand, DepthImagePoint Elbow, DepthImagePoint Shoulder, Hand obj, String name)
        {
            double UpArm = Math.Sqrt(((Elbow.X - Shoulder.X) * (Elbow.X - Shoulder.X)) + ((Elbow.Y - Shoulder.Y) * (Elbow.Y - Shoulder.Y)) + ((Elbow.Depth - Shoulder.Depth) * (Elbow.Depth - Shoulder.Depth)));
             double forArmD = (Elbow.Depth - hand.Depth);
             //(hand.Y < (.8 * Elbow.Y) || Elbow.Y < (Shoulder.Y + (UpArm / 2)))
             //Console.Write(" {0}, {1}, {2}\n", hand.Depth > Elbow.Depth * 0.92, hand.Depth, Elbow.Depth);
             if (inMenu == true)
             {

             if (hand.X <= 400 && hand.X >= 100 && hand.Y <= 400 && hand.Y >= 300)
             {
                 menuTimer++;
                 if (menuTimer >= 100)
                 {
                     inMenu = false;
                 }
             }
             else if (hand.X <= 720 && hand.X >= 420 && hand.Y <= 400 && hand.Y >= 300)
             {
                 menuTimer++;
                 if (menuTimer >= 100)
                 {
                     exiting = true;
                 }
             }
             else
             {

             }
             }
             else
             {
             if (hand.X <= Shoulder.X + 50 && hand.X >= Shoulder.X - 50
                 && hand.Y <= Shoulder.Y + 50 && hand.Y >= Shoulder.Y - 50
                 && hand.Depth <= Shoulder.Depth + 50 && hand.Depth >= Shoulder.Depth - 50) {
                     inMenu = true;
             }
             else if (/*(hand.Depth > Elbow.Depth * 0.92) /*&& (hand.Y < (1.3 * Elbow.Y))*/ Shoulder.Depth >= (hand.Depth + 250))
             {
                 if (Shoulder.Depth >= (hand.Depth + 325))
                 {
                     obj.pressed = true;
                 }
                 else
                 {
                     obj.pressed = false;
                 }
             }
             else
             {
                 //Console.Write("{0} Rest\n", name);
             }
             //Console.Write("UpArm: {0}, ForArmD: {1}, Y: {2}\n", UpArm, forArmD, hand.Y);
             }
        }
コード例 #3
0
ファイル: Game1.cs プロジェクト: verweij/battleships
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            SoundEffect tempSounds = Content.Load<SoundEffect>(@"sounds/bomb");

             // Create a new SpriteBatch, which can be used to draw textures.
             spriteBatch = new SpriteBatch(GraphicsDevice);
             texture = Content.Load<Texture2D>(@"images/p2target");
             P1RightHand = new Hand(new Vector2(200, 300), texture,0);
             P1LeftHand = new Hand(new Vector2(200, 300), texture,0);

             texture = Content.Load<Texture2D>(@"images/p1target");
             P2RightHand = new Hand(new Vector2(100, 300), texture,1);
             P2LeftHand = new Hand(new Vector2(100, 300), texture,1);

             texture = Content.Load<Texture2D>(@"images/p1battleship");
             textureAttack = Content.Load<Texture2D>(@"images/p1battleshipshooting");
             Boats.Add(new Boat(new Vector2(100,100), texture, textureAttack, 0, 0, tempSounds));
             Boats.Add(new Boat(new Vector2(100, 475), texture, textureAttack, 0, 0, tempSounds));

             texture = Content.Load<Texture2D>(@"images/p1destroyer");
             textureAttack = Content.Load<Texture2D>(@"images/p1destroyershooting");
             Boats.Add(new Boat(new Vector2(100, 175), texture, textureAttack, 0, 0, tempSounds));
             Boats.Add(new Boat(new Vector2(100, 400), texture, textureAttack, 0, 0, tempSounds));

             texture = Content.Load<Texture2D>(@"images/p1sub");
             textureAttack = Content.Load<Texture2D>(@"images/p1subshooting");
             Boats.Add(new Boat(new Vector2(100, 250), texture, textureAttack, 0, 0, tempSounds));
             Boats.Add(new Boat(new Vector2(100, 325), texture, textureAttack, 0, 0, tempSounds));

             texture = Content.Load<Texture2D>(@"images/p2battleship");
             textureAttack = Content.Load<Texture2D>(@"images/p2battleshipshooting");
             Boats.Add(new Boat(new Vector2(600, 100), texture, textureAttack, 0, 1, tempSounds));
             Boats.Add(new Boat(new Vector2(600, 475), texture, textureAttack, 0, 1, tempSounds));

             texture = Content.Load<Texture2D>(@"images/p2destroyer");
             textureAttack = Content.Load<Texture2D>(@"images/p2destroyershooting");
             Boats.Add(new Boat(new Vector2(600, 175), texture, textureAttack, 0, 1, tempSounds));
             Boats.Add(new Boat(new Vector2(600, 400), texture, textureAttack, 0, 1, tempSounds));

             texture = Content.Load<Texture2D>(@"images/p2sub");
             textureAttack = Content.Load<Texture2D>(@"images/p2subshooting");
             Boats.Add(new Boat(new Vector2(600, 250), texture, textureAttack, 0, 1, tempSounds));
             Boats.Add(new Boat(new Vector2(600, 325), texture, textureAttack, 0, 1, tempSounds));
             // TODO: use this.Content to load your game content here
        }
コード例 #4
0
        public Hand[] getHands()
        {
            Hand[] hands;
            Person[] activeUsers = getUsers();

            if (activeUsers != null)
            {
                hands = new Hand[activeUsers.Length * 2];

                for (int i = 0; i < activeUsers.Length; i++)
                {
                    hands[2 * i] = activeUsers[i].leftHand;
                    hands[(2 * i) + 1] = activeUsers[i].rightHand;

                }

                return hands;
            }

            hands = new Hand[0];

            return hands;
        }
コード例 #5
0
        private Boolean handInRange(Hand hand)
        {
            DotNET.Point handLoc;
            double dist, x, y;

            if (hand != null)
            {
                handLoc = hand.getLocation();

                x = handLoc.X * DaVinciExhibit.xScale;
                y = handLoc.Y * DaVinciExhibit.yScale;

                DotNET.Point convertedHandLoc = new DotNET.Point(x, y);

                // Compute the distance from the interaction button to a hand accessing it
                dist = Math.Pow(Location.X - convertedHandLoc.X, 2) + Math.Pow((Location.Y + radius) - radius - convertedHandLoc.Y, 2);
                //distances[i] = dist;
                // If a hand is touching the TutorialButton...
                if (dist < (radiusSq + hand.getAgentRadiusSq()))
                {
                    return true;
                }
            }

            return false;
        }
コード例 #6
0
            public void reset()
            {
                leftHand = null;
                rightHand = null;

                currState = ScissorGestureState.None;
            }