private void SetupGame() { Start.IsEnabled = true; PickCard1.IsEnabled = false; PickCard2.IsEnabled = false; PickCard3.IsEnabled = false; Shuffle.IsEnabled = false; Card1.DisplayCard(1); Card2.DisplayCard(1); Card3.DisplayCard(1); PlayerCard.DisplayCard(1); CPUCard.DisplayCard(1); StatusMessage.Text = "Press Start!"; }
private void GameRules(int PlayerIndex) { string WinMessage = ""; int ChosenCardIndex = PlayerIndex; int rand = RandomGenerator.Next(2, 14); while (ChosenCardIndex == rand) { rand = RandomGenerator.Next(2, 14); } CPUCard.DisplayCard(rand); int OpponentCardIndex = rand; if (ChosenCardIndex > OpponentCardIndex) { PNewScore = ((ChosenCardIndex + OpponentCardIndex) - 2) * 10; WinMessage = "Awesome! You won! You gained " + PNewScore + " points on your score!"; PScore = PScore + PNewScore; } else { CNewScore = ((ChosenCardIndex + OpponentCardIndex) - 2) * 10;; WinMessage = "Sorry, the opponent had the better card this time..."; CScore = CScore + CNewScore; } Start.Content = "Play Again?"; PlayerScore.Text = PScore.ToString(); CPUScore.Text = CScore.ToString(); StatusMessage.Text = WinMessage; }