Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void GamePlay()
- {
- currentPlayer = Players[currentPlayerIndex];
- if (IsPlayerOut(currentPlayer) == false)
- {
- if (Players[currentPlayerIndex].CurrentlyHasTurn == true)
- {
- if (currentPlayer.NeedsUserInput == true)
- HumanTurn(currentPlayer);
- else
- ComputerTurn(currentPlayer);
- }
- }
- else
- {
- currentPlayerIndex++;
- }
- GamePlay();
- }
- public void HumanTurn(Player player)
- {
- #region Highlight and enable matching cards
- if (firstLoop == false)
- {
- player.CurrentlyHasTurn = true;
- foreach (Card card in player.PlayerHand)
- {
- if (CheckCards(card) == true)
- {
- HighlightCard(player, card);
- playableCards.Add(card);
- }
- }
- foreach (var gridViewChild in player.PlayerGrid.Items)
- {
- if (gridViewChild is Border)
- {
- var border = gridViewChild as Border;
- var borderChild = border.Child;
- if (borderChild is Button)
- {
- var button = borderChild as Button;
- if (playableCards.Contains(button.Tag as Card))
- {
- ToggleButton(button);
- }
- }
- }
- }
- firstLoop = true;
- }
- #endregion
- if (playableCards.Count == 0)
- {
- CantPlayCards(player);
- }
- else
- {
- if (ClickedCard != null)
- {
- PlayCard(player, ClickedCard);
- ClickedCard = null;
- player.CurrentlyHasTurn = false;
- playableCards.Clear();
- currentPlayerIndex++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement