// Update: public override void Update(GameTime gameTime, KeyboardState ks) { base.Update(gameTime, ks); // Move the player if (moveNum > 0) { // Find next space E_Space spaceToMoveTo = currPlayer.currSpace.spacesAhead[0]; // Move the meeple untill it's close enough to space if (Vector2.Distance(spaceToMoveTo.getMeepleLocation(), currPlayer.meeple.getPosCenter()) > 1.0F) { float newX = MGP_Tools.Ease(currPlayer.meeple.getPosCenter().X, spaceToMoveTo.getMeepleLocation().X, 0.15F); float newY = MGP_Tools.Ease(currPlayer.meeple.getPosCenter().Y, spaceToMoveTo.getMeepleLocation().Y, 0.15F); currPlayer.meeple.setPos(new Vector2(newX, newY)); MGP_Tools.Follow_Player(parentManager, currPlayer); // Play space sound effect: if (!soundPlayed) { parentManager.audioEngine.playSound(MGP_Constants.soundEffects.space, 0.7f); soundPlayed = true; } } // Meeple has arrived at new space else { moveNum--; currPlayer.currSpace = spaceToMoveTo; // allow sound to play next time: soundPlayed = false; // If player passes a star if (currPlayer.currSpace.type == Entity.typeSpace.star) { S_BuyStar buyStar = new S_BuyStar(parentManager, 0, 0); parentManager.AddStateQueue(buyStar); this.active = false; //pause moving player } } } // finished moving meeple else { // Occupy that space so another meeple doesn't run him/her over: currPlayer.currSpace.occupySpace(currPlayer); S_LandAction landAction = new S_LandAction(parentManager, 0, 0); parentManager.AddStateQueue(landAction); this.flagForDeletion = true; } // Listen for pausing here: ListenPause(); }
// Update: public override void Update(GameTime gameTime, KeyboardState ks) { base.Update(gameTime, ks); // do this at the beginning of every round, but only once: if (roundStart) { // Set the player ui's to white at the beginning of each round: foreach (Player p in parentManager.gameOptions.players) { p.uiColor = Color.White; } // switch minigames: minigame = (minigame == 0) ? 1 : 0; // Queue pirate bay music again: parentManager.audioEngine.setNextSong(MGP_Constants.music.pirateBay); parentManager.audioEngine.playNextSong(85, true); Console.WriteLine("Added pirateBay to music queue"); // only run once each round: roundStart = false; } // Move camera to player MGP_Tools.Follow_Player(parentManager, currPlayer); // Start next player's turn if (!playerIsPlaying) { // Last player went. Go to minigame if (playerIndex == 4) { // Queue minigame music: parentManager.audioEngine.setNextSong(MGP_Constants.music.minigame); parentManager.audioEngine.playNextSong(50, true); S_MinigameInstructions minigameInstructions = new S_MinigameInstructions(parentManager, 0, 0, minigame); parentManager.AddStateQueue(minigameInstructions); playerIndex = 0; // start with player one when round resumes this.active = false; } // Start next players turn else { currPlayer = gameOptions.players[playerIndex]; // set current player MGP_Tools.Follow_Player(parentManager, currPlayer); // move camera to current player // start confirm player state S_ConfirmPlayer confirmPlayer = new S_ConfirmPlayer(parentManager, 0, 0); parentManager.AddStateQueue(confirmPlayer); this.active = false; //set vars for next round playerIndex++; playerIsPlaying = true; } } // Listen for and allow for pauses: ListenPause(); // Update player places: updatePlayerPlaces(); } // end Update method