public override void Update(GameTime gameTime, KeyboardState ks) { base.Update(gameTime, ks); // Buy the star Or acknowledging they suck and cant buy the star, either way move on if (parentManager.km.ActionPressed(KeyboardManager.action.select, KeyboardManager.playerIndex.all) || AI_Timer > 60 || moveYPos > 90) { // start the animation for getting a star if (buystar) { startAnimation = true; } // Finished star animation or couldnt buy star if (moveYPos > 90 || !buystar) { // Move the star to new space if (buystar) { MGP_Tools.Assign_Star(parentManager.boardGame); parentManager.round.currPlayer.currSpace.type = Entity.typeSpace.chance; } this.flagForDeletion = true; // Start moving the player again parentManager.states.Find(s => s.GetType() == typeof(S_MovePlayer)).active = true; } } // If player is buying star, start animation for buying star if (startAnimation) { moveYPos++; } // If current play is com, increase AI_Timer if (!parentManager.round.currPlayer.isHuman) { AI_Timer++; } }
// Collection of Spaces: //public List<E_Space> spaces; // Constructor: public B_PirateBay(GameStateManager creator, float xPos, float yPos) : base(creator, xPos, yPos) { // --------------------------- Create Spaces: ---------------------------------- // initialize list of spaces: spaces = new List <E_Space>(); E_Space curSpace; E_Space prevSpace; // STARTING WITH BOTTOM RIGHT // <<---- MOVING LEFT NOW: ----->> // Bottom right space: curSpace = new E_Space(this, GetTilePosCenter(21, 16), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.left); spaces.Add(curSpace); this.startingSpace = curSpace; // STARTING SPACE prevSpace = curSpace; // 20, 16 // Blue curSpace = new E_Space(this, GetTilePosCenter(20, 16), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.left); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 19, 16 // Blue curSpace = new E_Space(this, GetTilePosCenter(19, 16), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.left); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 17, 16 // Red curSpace = new E_Space(this, GetTilePosCenter(17, 16), Entity.typeSpace.red); curSpace.setOverlapPositions(E_Space.direction.left); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 16, 15 // Blue curSpace = new E_Space(this, GetTilePosCenter(16, 15), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.left); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 15, 15 // Blue curSpace = new E_Space(this, GetTilePosCenter(15, 15), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.left); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 14, 15 // Red curSpace = new E_Space(this, GetTilePosCenter(14, 15), Entity.typeSpace.red); curSpace.setOverlapPositions(E_Space.direction.left); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 12, 15 // Blue curSpace = new E_Space(this, GetTilePosCenter(12, 15), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.left); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 12, 16 // Blue curSpace = new E_Space(this, GetTilePosCenter(12, 16), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.left); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 10, 16 curSpace = new E_Space(this, GetTilePosCenter(10, 16), Entity.typeSpace.red); curSpace.setOverlapPositions(E_Space.direction.left); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 7, 16 curSpace = new E_Space(this, GetTilePosCenter(7, 16), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.left); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 6, 16 CHANCE TIME curSpace = new E_Space(this, GetTilePosCenter(6, 16), Entity.typeSpace.chance); curSpace.setOverlapPositions(E_Space.direction.left); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // <<---- MOVING UP NOW: ----->> // 6, 15 curSpace = new E_Space(this, GetTilePosCenter(6, 15), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.up); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 6, 13 curSpace = new E_Space(this, GetTilePosCenter(6, 13), Entity.typeSpace.red); curSpace.setOverlapPositions(E_Space.direction.up); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 6, 10 curSpace = new E_Space(this, GetTilePosCenter(6, 10), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.up); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 6, 9 curSpace = new E_Space(this, GetTilePosCenter(6, 9), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.up); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 4, 9 curSpace = new E_Space(this, GetTilePosCenter(4, 9), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.up); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 3, 9 curSpace = new E_Space(this, GetTilePosCenter(3, 9), Entity.typeSpace.chance); curSpace.setOverlapPositions(E_Space.direction.up); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 3, 8 curSpace = new E_Space(this, GetTilePosCenter(3, 8), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.up); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 3, 7 curSpace = new E_Space(this, GetTilePosCenter(3, 7), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.up); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 3, 3 curSpace = new E_Space(this, GetTilePosCenter(3, 3), Entity.typeSpace.red); curSpace.setOverlapPositions(E_Space.direction.up); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 3, 2 curSpace = new E_Space(this, GetTilePosCenter(3, 2), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.up); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // <<---- MOVING RIGHT NOW: ----->> // 4, 1 curSpace = new E_Space(this, GetTilePosCenter(4, 1), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.right); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 5, 1 curSpace = new E_Space(this, GetTilePosCenter(5, 1), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.right); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 7, 1 curSpace = new E_Space(this, GetTilePosCenter(7, 1), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.right); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 8, 2 curSpace = new E_Space(this, GetTilePosCenter(8, 2), Entity.typeSpace.red); curSpace.setOverlapPositions(E_Space.direction.right); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 9, 2 curSpace = new E_Space(this, GetTilePosCenter(9, 2), Entity.typeSpace.red); curSpace.setOverlapPositions(E_Space.direction.right); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 10, 3 curSpace = new E_Space(this, GetTilePosCenter(10, 3), Entity.typeSpace.red); curSpace.setOverlapPositions(E_Space.direction.right); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 12, 3 curSpace = new E_Space(this, GetTilePosCenter(12, 3), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.right); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 13, 3 curSpace = new E_Space(this, GetTilePosCenter(13, 3), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.right); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 14, 3 curSpace = new E_Space(this, GetTilePosCenter(14, 3), Entity.typeSpace.chance); curSpace.setOverlapPositions(E_Space.direction.right); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 16, 3 curSpace = new E_Space(this, GetTilePosCenter(16, 3), Entity.typeSpace.red); curSpace.setOverlapPositions(E_Space.direction.right); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 17, 4 curSpace = new E_Space(this, GetTilePosCenter(17, 4), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.right); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 18, 4 curSpace = new E_Space(this, GetTilePosCenter(18, 4), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.right); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // <<---- MOVING DOWN NOW: ----->> // 19, 5 curSpace = new E_Space(this, GetTilePosCenter(19, 5), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.down); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 19, 7 curSpace = new E_Space(this, GetTilePosCenter(19, 7), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.down); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 19, 8 curSpace = new E_Space(this, GetTilePosCenter(19, 8), Entity.typeSpace.red); curSpace.setOverlapPositions(E_Space.direction.down); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 19, 10 curSpace = new E_Space(this, GetTilePosCenter(19, 10), Entity.typeSpace.chance); curSpace.setOverlapPositions(E_Space.direction.down); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 19, 11 curSpace = new E_Space(this, GetTilePosCenter(19, 11), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.down); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 19, 13 curSpace = new E_Space(this, GetTilePosCenter(19, 13), Entity.typeSpace.red); curSpace.setOverlapPositions(E_Space.direction.down); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 21, 13 curSpace = new E_Space(this, GetTilePosCenter(21, 13), Entity.typeSpace.blue); curSpace.setOverlapPositions(E_Space.direction.down); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 22, 13 curSpace = new E_Space(this, GetTilePosCenter(22, 13), Entity.typeSpace.red); curSpace.setOverlapPositions(E_Space.direction.down); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); prevSpace = curSpace; // 22, 15 FINAL PIECE curSpace = new E_Space(this, GetTilePosCenter(22, 15), Entity.typeSpace.chance); curSpace.setOverlapPositions(E_Space.direction.down); spaces.Add(curSpace); // add to overall list curSpace.assignSpaces(prevSpace); this.finalSpace = curSpace; // FINAL SPACE // Finally, link up last space and first space: this.startingSpace.assignSpaces(this.finalSpace); // Assign the star space to a random space MGP_Tools.Assign_Star(this); // Assign starting space to all players foreach (Player p in this.gameOptions.players) { p.currSpace = this.startingSpace; p.meeple.setPos(p.currSpace.getMeepleLocation()); // Occupy that space so another meeple doesn't run him/her over: p.currSpace.occupySpace(p); } } // end constructor