// Get next available plunger selection to the right public void getNextSelectionRight() { do { if (currSelection == plungers[plungers.Count - 1]) { currSelection = plungers[0]; } else { currSelection = plungers[plungers.FindIndex(x => x == currSelection) + 1]; } } while (currSelection.pressed); }
// Constructor for Main Menu: public S_Minigame1(GameStateManager creator, float xPos, float yPos, bool playGame) : base(creator, xPos, yPos) { // Create the list of players and empty list for results players = new List <Player>(creator.gameOptions.players); resultsList = new List <Player>(); // Create the list of positions for players playerPositions = new List <Vector2>() { new Vector2(150, 500), new Vector2(450, 500), new Vector2(750, 500), new Vector2(1050, 500) }; // Create the list of plungers plungers = new List <E_MinigameOnePlunger>() { new E_MinigameOnePlunger(this, creator.game.minigame_one_plungerUp, 300, 275, Color.Green), new E_MinigameOnePlunger(this, creator.game.minigame_one_plungerUp, 440, 275, Color.Blue), new E_MinigameOnePlunger(this, creator.game.minigame_one_plungerUp, 590, 275, Color.Yellow), new E_MinigameOnePlunger(this, creator.game.minigame_one_plungerUp, 740, 275, Color.Red), new E_MinigameOnePlunger(this, creator.game.minigame_one_plungerUp, 875, 275, Color.Purple) }; // Set one of the plungers to be the bomb plungers[creator.random.Next(0, plungers.Count)].isBomb = true; // Start with 0 selected plungers selectedPlungers = 0; // Set number of human players numOfPlayers = parentManager.gameOptions.numPlayers; // Start with first player playerIndex = 0; currentPlayer = players[playerIndex]; plungerIndex = 0; currSelection = plungers[plungerIndex]; explosionSprite = new E_MinigameOneExplosion(this); isExploding = false; waitTime = maxWaitTime; // DEBUG: SKIP THE GAME this.playGame = playGame; }
// HELPER FUNCTIONS // Reset plunger selections public void resetSelections() { selectedPlungers = 0; foreach (E_MinigameOnePlunger p in plungers) { p.isBomb = false; p.pressed = false; p.Update_Sprite(); } // Assign a new bomb plungers[parentManager.random.Next(0, plungers.Count)].isBomb = true; // Reset current selection currSelection = plungers[0]; }