void HandleInput(GameTime gameTime) { fizzyoButtonPressed = false; if (fizzyo.ButtonDown()) { //Do Something with the Button fizzyoButtonPressed = true; } var pressureReading = fizzyo.Pressure(); // Get the current Pressure value GoodBreath = breathRecogniser.AddSample(gameTime.ElapsedGameTime.Milliseconds, pressureReading); if (!breathRecogniser.IsExhaling) { GoodBreath = breathRecogniser.isLastBreathGood; } pressurevalue = pressureReading; }
public void updateGamePlay(GameTime gameTime) { fizzyoDevice.Update(gameTime); inputState.Update(gameTime); score += 1; KeyboardState keys = Keyboard.GetState(); if (keys.IsKeyDown(Keys.Up)) { Player.StartMovingUp(); } else { Player.StopMovingUp(); } if (keys.IsKeyDown(Keys.Down)) { Player.StartMovingDown(); } else { Player.StopMovingDown(); } float startRightMovement = Player.xPosition; if (/*keys.IsKeyDown(Keys.G)*/ breathRecogniser.isLastBreathGood) { Player.GoodBreath(startRightMovement); } if (keys.IsKeyDown(Keys.B)) { Player.BadBreath(startRightMovement); } if (Player.xPosition < screenWidth / 1000) { GameOver(); } PlayerTexture(); EnemyTextureSelector(); foreach (Enemies enemy in e) { double dx = (Player.xPosition - enemy.position.X); double dy = (Player.yPosition - enemy.position.Y); if ((Math.Sqrt((dx * dx) + (dy * dy))) < (enemy.texture.Width)) { long TimeBetweenLastCollison = stopwatch.ElapsedMilliseconds; if (TimeBetweenLastCollison == 0 || TimeBetweenLastCollison > 3000) { stopwatch.Reset(); stopwatch.Start(); ReduceOrEnd(); } } } foreach (Enemies enemy in e) { enemy.Update(graphics.GraphicsDevice); } foreach (Player s in gameSprites) { s.Update(1.0f / 60.0f); } /// /// FIZZYO IN GAME LOOP /// InputState inputstate = new InputState(this); breathRecogniser.AddSample(gameTime.ElapsedGameTime.Milliseconds, fizzyoDevice.Pressure()); }