Exemplo n.º 1
0
 public void NextTurn()
 {
     if (cardsDelt)
     {
         if (opponent.isPlayersTurn())
         {
             if (Opponent.GetHand().GetNumberOfCards() > 0)
             {
                 playedCard = Opponent.GetComponent <Player_Behavior>().make_a_move();
             }
             else
             {
                 Opponent.GetPlayerState().SetPassing();
             }
         }
         else if (player.isPlayersPassing() && opponent.isPlayersPassing())
         {
             playerCounter.Counter();
             opponentCounter.Counter();
             string outcome = DetermineRoundWinner();
             if (Player.GetScore() == Num_to_Win || Opponent.GetScore() == Num_to_Win || games_played == Max_Games)
             {
                 outcome   = DetermineGameWinner();
                 cardsDelt = false;
             }
             Outcome.Display(outcome);
             Debug.Log(outcome);
             RollForInitiative();
             Invoke("ResetBoard", 2);
             if (cardsDelt == false)
             {
                 Invoke("MainMenuReturn", 2);
             }
             else if (RoundWinner != null)
             {
                 RoundWinner.GetDeck().DealCards(1, RoundWinner.GetHand().gameObject);
                 ApplyModifiers(RoundWinner);
                 if (RoundWinner == Opponent)
                 {
                     Opponent.GetHand().ShowBack();
                 }
                 else
                 {
                     player_cards = Player.GetHand().GetNumberOfCards();
                 }
             }
             return;
         }
     }
     if (playedCard != null)
     {
         ApplyCardModifiers(playedCard, CurrentPlayer, NextPlayer);
         playedCard = null;
     }
     DetermineNewStates();
     playerCounter.Counter();
     opponentCounter.Counter();
 }
Exemplo n.º 2
0
 private void Update()
 {
     if (cardsDelt)
     {
         /*CurrentPlayer.GetPlayField().gameObject.GetComponent<SP_CardPile_Display>().UpdateDisplay();
          * NextPlayer.GetPlayField().gameObject.GetComponent<SP_CardPile_Display>().UpdateDisplay();*/
         CurrentPlayer.GetPlayField().gameObject.GetComponent <SP_CardPile_Display>().RefreshLayoutGroupsImmediateAndRecursive(CurrentPlayer.GetPlayField().gameObject);
         NextPlayer.GetPlayField().gameObject.GetComponent <SP_CardPile_Display>().RefreshLayoutGroupsImmediateAndRecursive(NextPlayer.GetPlayField().gameObject);
         if (!enemyBehavior.IsMakingMove() && opponent.isPlayersTurn())
         {
             if (Opponent.GetHand().GetNumberOfCards() > 0)
             {
                 enemyBehavior.make_a_move();
             }
             else
             {
                 Opponent.GetPlayerState().SetPassing();
             }
         }
         else if (player.isPlayersPassing() && opponent.isPlayersPassing() && !waiting)
         {
             playerCounter.Counter();
             opponentCounter.Counter();
             string outcome = DetermineRoundWinner();
             if (Player.GetScore() == Num_to_Win || Opponent.GetScore() == Num_to_Win || games_played == Max_Games)
             {
                 outcome   = DetermineGameWinner();
                 cardsDelt = false;
             }
             Outcome.Display(outcome);
             Debug.Log(outcome);
             waiting = true;
             Invoke("ResetBoard", 2);
             if (cardsDelt == false)
             {
                 Invoke("MainMenuReturn", 2);
             }
             else if (RoundWinner != null)
             {
                 RoundWinner.GetDeck().DealCards(1, RoundWinner.GetHand().gameObject);
                 ApplyModifiers(RoundWinner);
                 if (RoundWinner == Opponent)
                 {
                     Opponent.GetHand().ShowBack();
                 }
                 else
                 {
                     player_cards = Player.GetHand().GetNumberOfCards();
                 }
             }
             return;
         }
         else if (Player.GetHand().GetNumberOfCards() == 0)
         {
             Player.GetPlayerState().SetPassing();
         }
         else if (Player.GetPlayerState().isPlayersPassing() || Opponent.GetPlayerState().isPlayersPassing())
         {
             DetermineNewStates();
         }
     }
 }