Esempio n. 1
0
 private void CheckSolution(string myChoice)
 {
     if (round == 1)
     {
         PullCard();
         Card thisCard = ShowCard.GetChild(0).GetComponent <Card>();
         if (myChoice == thisCard.color.ToLower())
         {
             round++;
         }
         else
         {
             Lose = true;
         }
     }
     else if (round == 2)
     {
         PullCard();
         Card   thisCard = ShowCard.GetChild(0).GetComponent <Card>();
         Card   prevCard = DiscardPile.GetChild(DiscardPile.childCount - 1).GetComponent <Card>();
         string answer   = (thisCard.number > prevCard.number) ? "high" : "low";
         if (myChoice == answer)
         {
             round++;
         }
         else
         {
             Lose = true;
         }
     }
     else if (round == 3)
     {
         PullCard();
         Card   thisCard = ShowCard.GetChild(0).GetComponent <Card>();
         Card   HighCard = (DiscardPile.GetChild(DiscardPile.childCount - 1).GetComponent <Card>().number > DiscardPile.GetChild(DiscardPile.childCount - 2).GetComponent <Card>().number) ? DiscardPile.GetChild(DiscardPile.childCount - 1).GetComponent <Card>() : DiscardPile.GetChild(DiscardPile.childCount - 2).GetComponent <Card>();
         Card   LowCard  = (DiscardPile.GetChild(DiscardPile.childCount - 1).GetComponent <Card>().number < DiscardPile.GetChild(DiscardPile.childCount - 2).GetComponent <Card>().number) ? DiscardPile.GetChild(DiscardPile.childCount - 1).GetComponent <Card>() : DiscardPile.GetChild(DiscardPile.childCount - 2).GetComponent <Card>();
         string answer   = (thisCard.number <HighCard.number && thisCard.number> LowCard.number) ? "inbetween" : "outside";
         if (myChoice == answer)
         {
             round++;
         }
         else
         {
             Lose = true;
         }
     }
     Wait(5f);
     RoundStart();
 }