예제 #1
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

#if COMPLETE
            if (kinect.IsAvailable)
            {
                _timerKinectOver.Update(gameTime);

                Vector3 hand = kinect.GetUserProfile(KinectPlayerIndex.One).HandRight;
                _handSelector.Position = new Vector2(hand.X, hand.Y);

                foreach (MenuItem item in items)
                {
                    if (CheckKinectOver(item, (int)hand.X, (int)hand.Y))
                    {
                        item_MouseOver(item, new MouseOverSpriteEventArgs((int)hand.X, (int)hand.Y));

                        if (_kinectValidedAction)
                        {
                            item_MouseJustClicked(item, new MouseClickSpriteEventArgs((int)hand.X, (int)hand.Y, Yna.Input.MouseButton.Left, true, false));
                        }

                        if (_timerKinectOver.Active)
                        {
                            _transitionKinectOver.Update(gameTime);
                            _handSelector.Alpha = _transitionKinectOver.Alpha;
                        }
                        else
                        {
                            _timerKinectOver.Restart();
                        }
                    }

                    else if (CheckKinectLeave(item, (int)_lastKinectPosition.X, (int)_lastKinectPosition.Y, (int)hand.X, (int)hand.Y))
                    {
                        item_MouseLeave(item, new MouseLeaveSpriteEventArgs((int)_lastKinectPosition.X, (int)_lastKinectPosition.Y, (int)hand.X, (int)hand.Y));
                        _timerKinectOver.Stop();
                        _handSelector.Color  = Color.White;
                        _handSelector.Alpha  = 1.0f;
                        _kinectValidedAction = false;
                    }
                }

                _lastKinectPosition = hand;
            }
            else
            {
                _handSelector.Position = new Vector2(YnG.Mouse.X, YnG.Mouse.Y);
            }
#else
            _handSelector.Position = new Vector2(YnG.Mouse.X, YnG.Mouse.Y);
#endif
        }
예제 #2
0
 void messageBoxEnd_CloseRequested(object sender, EventArgs e)
 {
     _looseTimer.Stop();
     ChangeGameStatus(GameStatus.Running, true);
 }