示例#1
0
 /// <summary>
 /// Runs player movement function and checks to see if gun should be fired
 /// </summary>
 /// <param name="kbState">Current keyboard state to be tested</param>
 /// <param name="currentMouseState">Current mouse state to be tested</param>
 /// <param name="previousMouseState">Previous mouse state to be tested</param>
 public void Update(KeyboardState kbState, MouseState currentMouseState, MouseState previousMouseState, bool safe)
 {
     // Move
     PlayerMovement(kbState);
     // Set angle
     SetAngle(currentMouseState.X, currentMouseState.Y);
     // Shoot (if left mouse button is down)
     if (!safe && currentMouseState.LeftButton == ButtonState.Pressed && CurrentWeapon != null)
     {
         CurrentWeapon.PullTrigger(currentMouseState, previousMouseState);
     }
     base.Update();
 }