// 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(); }
// Constructor: public S_ChanceTime(GameStateManager creator, float xPos, float yPos, S_LandAction creatorState) : base(creator, xPos, yPos) { this.p = creator.round.currPlayer; this.landActionCreator = creatorState; this.landActionCreator.active = false; this.diceNum = 0; this.hit = false; this.musicCounter = 0; this.delayDrum = DELAY_DRUM_START; this.delayString = this.delayDrum * 2; this.drumVolume = DRUM_ACCENT_VOLUME; this.suspenseLevel = 0.2f; this.highString = true; this.aiTimer = 0; this.aiHitTime = creator.random.Next(AI_HIT_TIMER_MIN, AI_HIT_TIMER_MAX); this.finishTransition = false; this.finishTimer = 0; // List of players that can be picked (starts with all): this.playersToPick = new List <Player>(); foreach (Player p in creator.gameOptions.players) { this.playersToPick.Add(p); } implementedEvent = false; // the action is taken for the event chosen // Create the three blocks: leftBlock = new E_ChanceBlock(this, creator.game.spr_chanceBlock, BLOCK_LEFT_X, BLOCK_Y, BlockType.character, playersToPick); middleBlock = new E_ChanceBlock(this, creator.game.spr_chanceBlock, BLOCK_MIDDLE_X, BLOCK_Y, BlockType.condition, playersToPick); rightBlock = new E_ChanceBlock(this, creator.game.spr_chanceBlock, BLOCK_RIGHT_X, BLOCK_Y, BlockType.character, playersToPick); leftMeepleStartPos = new Vector2(-100f, 580f); leftMeepleEndPos = new Vector2((float)(MGP_Constants.SCREEN_WIDTH * 0.25), 580f); rightMeepleStartPos = new Vector2(MGP_Constants.SCREEN_WIDTH + 100f, 580f); RightMeepleEndPos = new Vector2((float)(MGP_Constants.SCREEN_WIDTH * 0.75), 580f); } // end constructor