public override void Update(GameTime gameTime) { base.Update(gameTime); _playerTouchedTimer.Update(gameTime); _weaponManager.Update(gameTime); // Mise à jour de la position du bouclier _shields.X = X + Width / 2 - _shields.Width / 2; _shields.Y = Y + Height / 2 - _shields.Height / 2; if (_shields.Active) { if (_shield > 0) { _shields.Play("blueStrong"); } else { _shields.Play("smallBlack"); } _shields.Update(gameTime); } #region Gamepad if (YnG.Gamepad.Connected(_playerIndex)) { if (YnG.Gamepad.LeftStickUp(_playerIndex)) { VelocityY -= _shipSpeed.Up * YnG.Gamepad.LeftStickValue(_playerIndex).Y * 1.5f; } else if (YnG.Gamepad.LeftStickDown(PlayerIndex.One)) { VelocityY -= _shipSpeed.Down * YnG.Gamepad.LeftStickValue(_playerIndex).Y * 1.5f; } if (YnG.Gamepad.LeftStickLeft(_playerIndex)) { VelocityX += _shipSpeed.Left * YnG.Gamepad.LeftStickValue(_playerIndex).X * 1.5f; } if (YnG.Gamepad.LeftStickRight(_playerIndex)) { VelocityX += _shipSpeed.Right * YnG.Gamepad.LeftStickValue(_playerIndex).X * 1.5f; } if (YnG.Gamepad.Pressed(_playerIndex, Buttons.RightTrigger)) { _weaponManager.Shoot(1); } if (YnG.Gamepad.JustPressed(_playerIndex, Buttons.LeftTrigger)) { _weaponManager.Shoot(2); } } #endregion #region Clavier // Le joueur 2 peut utiliser le clavier si le joueur 1 à une manette de branchée if (_playerIndex == PlayerIndex.Two && YnG.Gamepad.Connected(PlayerIndex.One) && !YnG.Gamepad.Connected(PlayerIndex.Two)) { UpdateKeyboardControl(); } else if (_playerIndex == PlayerIndex.One) { UpdateKeyboardControl(); } #endregion #if COMPLETE #region kinect if (kinect.IsAvailable) { Vector3 handRight = kinect.GetUserProfile(_kinectPlayerIndex).HandRight; Vector3 handLeft = kinect.GetUserProfile(_kinectPlayerIndex).HandLeft; X = (int)handRight.X; Y = (int)handRight.Y; if (handLeft.Y > 500) { Shoot(); } if (handLeft.Y < 20) { SelectedNextWeapon(); } } #endregion #endif }