/// <summary> /// Handles input for quitting the game. /// </summary> void HandleInput() { lastGamePadState = currentGamePadState; currentGamePadState = GamePad.GetState(PlayerIndex.One); // Check for exit. if (currentGamePadState.Buttons.Back == ButtonState.Pressed) { Exit(); } // Check to see if we need to change play modes if (currentGamePadState.Buttons.LeftShoulder == ButtonState.Pressed && lastGamePadState.Buttons.LeftShoulder != ButtonState.Pressed) { animationPlaybackMode += 1; if (animationPlaybackMode > AnimationPlaybackMode.Wave) { animationPlaybackMode = AnimationPlaybackMode.All; } } // Check to see if we should load another random avatar if (currentGamePadState.Buttons.RightShoulder == ButtonState.Pressed && lastGamePadState.Buttons.RightShoulder != ButtonState.Pressed) { avatarDescription = AvatarDescription.CreateRandom(); avatarRenderer = new AvatarRenderer(avatarDescription); } }
/// <summary> /// Updates the state of the game. This method checks the GameScreen.IsActive /// property, so the game will stop updating when the pause menu is active, /// or if you tab away to a different application. /// </summary> public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) { //Avatar Stuff UpdateCamera(gameTime); // Set avatar rendering matrices avatarRenderer.World = world; avatarRenderer.View = view; avatarRenderer.Projection = projection; // Update the current animation and world space bones if (avatarRenderer.IsLoaded) { waveAnimation.Update(gameTime.ElapsedGameTime, true); celebrateAnimation.Update(gameTime.ElapsedGameTime, true); standAnimation0.Update(gameTime.ElapsedGameTime, true); UpdateTransforms(); } try { //Gamer.SignedInGamers[ControllingPlayer.Value].Presence.PresenceValue = counter; Gamer.SignedInGamers[ControllingPlayer.Value].Presence.PresenceMode = GamerPresenceMode.Score; } catch { //Nothing goes here } base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); //change avatar animation animationPlaybackMode = AnimationPlaybackMode.Celebrate; if (c > 27) c = 0; if (c < 0) c = 27; switch (c) { case 0: p1=content.Load<Texture2D>("images/0"); break; case 1: p1 = content.Load<Texture2D>("images/1"); break; case 2: p1 = content.Load<Texture2D>("images/2"); break; case 3: p1 = content.Load<Texture2D>("images/3"); break; case 4: p1 = content.Load<Texture2D>("images/4"); break; case 5: p1 = content.Load<Texture2D>("images/5"); break; case 6: p1 = content.Load<Texture2D>("images/6"); break; case 7: p1 = content.Load<Texture2D>("images/7"); break; case 8: p1 = content.Load<Texture2D>("images/8"); break; case 9: p1 = content.Load<Texture2D>("images/9"); break; case 10: p1 = content.Load<Texture2D>("images/10"); break; case 11: p1 = content.Load<Texture2D>("images/11"); break; case 12: p1 = content.Load<Texture2D>("images/12"); break; case 13: p1 = content.Load<Texture2D>("images/13"); break; case 14: p1 = content.Load<Texture2D>("images/14"); break; case 15: p1 = content.Load<Texture2D>("images/15"); break; case 16: p1 = content.Load<Texture2D>("images/16"); break; case 17: p1 = content.Load<Texture2D>("images/17"); break; case 18: p1 = content.Load<Texture2D>("images/18"); break; case 19: p1 = content.Load<Texture2D>("images/19"); break; case 20: p1 = content.Load<Texture2D>("images/20"); break; case 21: p1 = content.Load<Texture2D>("images/21"); break; case 22: p1 = content.Load<Texture2D>("images/22"); break; case 23: p1 = content.Load<Texture2D>("images/23"); break; case 24: p1 = content.Load<Texture2D>("images/24"); break; case 25: p1 = content.Load<Texture2D>("images/25"); break; case 26: p1 = content.Load<Texture2D>("images/26"); break; case 27: p1 = content.Load<Texture2D>("images/27"); break; default: break; } }