Esempio n. 1
0
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            if (_isInitialized &&
                (ScreenState & UserInterface.ScreenState.NonInteractive) == 0)
            {
                MouseState currentState     = Mouse.GetState();
                Rectangle  mouseBoundingBox = new Rectangle(currentState.X, currentState.Y, 1, 1);

                foreach (GuiDrawable guiDrawable in _guiDrawable)
                {
                    guiDrawable.Update(currentState, _oldMouseState, mouseBoundingBox, gameTime);
                }

                foreach (ExerciseTile exerciseTile in _exerciseTiles)
                {
                    exerciseTile.Update(currentState, _oldMouseState, mouseBoundingBox, gameTime);
                }

                _colorStream.Update(gameTime);

                _repetitionString = string.Format(
                    "Completed {0} of {1}",
                    _exerciseQueue.CurrentExercise.Repetitions,
                    _exerciseQueue.CurrentExercise.RepetitionsToComplete
                    );

                _oldMouseState = currentState;
            }

            base.Update(gameTime);
        }
Esempio n. 2
0
 public override void Update(GameTime gameTime)
 {
     UpdateSkeletons(gameTime);
     if (ColorStream != null)
     {
         ColorStream.Update(gameTime);
     }
     if (DepthStream != null)
     {
         DepthStream.Update(gameTime);
     }
     base.Update(gameTime);
 }
Esempio n. 3
0
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            if (_isInitialized)
            {
                MouseState currentState     = Mouse.GetState();
                Rectangle  mouseBoundingBox = new Rectangle(currentState.X, currentState.Y, 1, 1);
                _colorStream.Update(gameTime);

                foreach (GuiDrawable guiDrawable in _guiDrawable)
                {
                    guiDrawable.Update(currentState, _oldMouseState, mouseBoundingBox, gameTime);
                }

                if (null != Chooser.Sensor &&
                    Chooser.Sensor.IsRunning)
                {
                    if (mouseBoundingBox.Intersects(_scrollable.GraceArea))
                    {
                        _scrollable.Update(currentState, _oldMouseState, mouseBoundingBox, gameTime);

                        if (currentState.LeftButton == ButtonState.Released &&
                            _oldMouseState.LeftButton == ButtonState.Pressed)
                        {
                            _timeStamp      = gameTime.TotalGameTime.TotalMilliseconds;
                            _elevationAngle = GetAngle();
                        }
                    }

                    if (_timeStamp != double.MinValue &&
                        gameTime.TotalGameTime.TotalMilliseconds - _timeStamp > 1500)
                    {
                        _timeStamp = double.MinValue;
                        /** Sometimes, the USB port can just cause an error because of its drivers */
                        try
                        {
                            Chooser.Sensor.ElevationAngle = _elevationAngle;
                        }
                        catch (Exception e) { }
                    }
                }

                _oldMouseState = currentState;
            }
            base.Update(gameTime);
        }
Esempio n. 4
0
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            /**
             * The exercise game component still "ups" the number of reps in its last update cycle
             * SO, this makes sure that the recording stops
             */
            if (_recordingManager.Status == RecordingManagerStatus.Recording)
            {
                _recordingManager.StopRecording();
            }

            if (_isInitialized &&
                (ScreenState & UserInterface.ScreenState.NonInteractive) == 0)
            {
                MouseState currentState     = Mouse.GetState();
                Rectangle  mouseBoundingBox = new Rectangle(currentState.X, currentState.Y, 1, 1);

                /** Update only the items pertinent to a RUNNING replay */
                if (_isReplaying)
                {
                    foreach (GuiDrawable guiDrawable in _guiDrawableReplay)
                    {
                        guiDrawable.Update(currentState, _oldMouseState, mouseBoundingBox, gameTime);
                    }

                    foreach (GuiDrawable guiDrawable in _guiDrawable)
                    {
                        if (guiDrawable.Text != "Catalog")
                        {
                            guiDrawable.Update(currentState, _oldMouseState, mouseBoundingBox, gameTime);
                        }
                    }
                }
                /** Update only the items pertinent to a SELECTING replay */
                else
                {
                    foreach (GuiDrawable guiDrawable in _guiDrawableSelect)
                    {
                        guiDrawable.Update(currentState, _oldMouseState, mouseBoundingBox, gameTime);
                    }

                    foreach (GuiDrawable guiDrawable in _guiDrawable)
                    {
                        guiDrawable.Update(currentState, _oldMouseState, mouseBoundingBox, gameTime);
                    }
                }

                if (Math.Ceiling(_colorStream.Size.X) == Math.Ceiling(_colorStreamSize.X) &&
                    !string.IsNullOrEmpty(_fileId))
                {
                    _recordingManager.StartReplaying(_fileId);
                    _fileId = string.Empty;
                }

                _colorStream.Size = Vector2.SmoothStep(
                    _colorStream.Size,
                    _colorStreamSize,
                    ANIMATION_RATE
                    );

                _colorStream.Update(gameTime);

                _oldMouseState = currentState;
            }

            base.Update(gameTime);
        }