private void StartGame() { //Play the preparation music soundPlayer.Stream = Properties.Resources.Preparation; soundPlayer.Play(); //Prompt the player for the difficulty of the match DifficultyPrompt diffPrompt = new DifficultyPrompt(); diffPrompt.ShowDialog(); //Create a new "game" currentGame = new Game((Difficulty)diffPrompt.selectedDifficulty); //Let the player choose the piece they wish to be, and assign it PiecePrompt piecePrompt = new PiecePrompt(); piecePrompt.ShowDialog(); currentGame.PlayerPiece = piecePrompt.selectedPiece; //Create a new AI player, and assign it the piece opposite of the player currentGame.aiPlayer = new AI(); currentGame.aiPlayer.AIPiece = Game.GetOppositePiece(currentGame.PlayerPiece); currentGame.AIPiece = currentGame.aiPlayer.AIPiece; //Determine who goes first DiceRollPrompt diceRoll = new DiceRollPrompt(); diceRoll.ShowDialog(); currentGame.CurrentPlayer = diceRoll.firstToGo; //Start the game currentGame.GameStarted = true; currentGame.GameState = Game.State.Playing; //Start the game timers gameTimer.Start(); countdownTimer.Start(); //Play battle music soundPlayer.Stop(); soundPlayer.Stream = Properties.Resources.BattleMusic; soundPlayer.PlayLooping(); }
private void StartGame() { //Create a new "game" currentGame = new Game(matchDifficulty[matchIndex]); //Repaint the grid RepaintGame(); //Determine if this is the champion match championMatchStarted = (matchIndex + 1 == NUMBER_OF_T_MATCHES) ? true : false; //Display the proper round roundLabel.Text = (championMatchStarted) ? "Final Round" : "Round " + (matchIndex + 1); //Assign the player's piece currentGame.PlayerPiece = playerPiece; //Create a new AI player, and assign it the piece opposite of the player currentGame.aiPlayer = new AI(); currentGame.aiPlayer.AIPiece = Game.GetOppositePiece(currentGame.PlayerPiece); currentGame.AIPiece = currentGame.aiPlayer.AIPiece; //Determine who goes first DiceRollPrompt diceRoll = new DiceRollPrompt(); if (championMatchStarted) { //Change the controls and time the music for the reveal of the champion if (!championMusicPlayed) { soundPlayer.Stop(); } diceRoll.Controls["aiNameLabel"].Text = "Champion"; PictureBox pb = diceRoll.Controls["aiPictureBox"] as PictureBox; pb.Image = Properties.Resources.championai; } diceRoll.ShowDialog(); currentGame.CurrentPlayer = diceRoll.firstToGo; //Start the game currentGame.GameStarted = true; currentGame.GameState = Game.State.Playing; //Start the game timers gameTimer.Start(); countdownTimer.Start(); //Play champion music for last fight, and set up champion profile if (!championMusicPlayed && championMatchStarted) { soundPlayer.Stop(); soundPlayer.Stream = Properties.Resources.ChampionMusic; soundPlayer.PlayLooping(); championMusicPlayed = true; aiNameLabel.Text = "The Champion"; aiPictureBox.Image = Properties.Resources.championai; } //Only battle music at beginning else if (!battleMusicPlayed) { soundPlayer.Stop(); soundPlayer.Stream = Properties.Resources.BattleMusic; soundPlayer.PlayLooping(); battleMusicPlayed = true; } }