Ejemplo n.º 1
0
        //Starts a new turn
        public static void NewTurn()
        {
            //Checks if the game is over
            if (CheckGameOver() || GameSetOver)
            {
                GameOver();
                Board.timer1.Stop();
            }
            else
            {
                CardClickAllowence(true);
                TurnBackCards();
                Board.Namechange(ActivePlayerIndex);

                //Check if the active player is an AI player and what difficulty if so
                if (PlayerList.list[ActivePlayerIndex].AI == true && PlayerList.list[ActivePlayerIndex].Skill == 1)
                {
                    CardClickAllowence(false);
                    AIeasy.PlayAI(Board);
                }
                else if (PlayerList.list[ActivePlayerIndex].AI == true && PlayerList.list[ActivePlayerIndex].Skill == 2)
                {
                    CardClickAllowence(false);
                    AIhard.PlayAI(Board);
                }
            }
        }
Ejemplo n.º 2
0
        //Cards call this function when clicked
        public static void CardCLicked(PlayCard sender)
        {
            //Sends the clicked card for the hard ai to rember
            AIhard.RemeberCard(sender);

            if (FirstTurn)
            {
                FirstTurn      = false;
                GameStarted    = true;
                Board.timeLeft = SaveGameSettings.Timer;
                Board.timer1.Start();
            }
            PickedCardsCount++;

            //When 2 cards have been picked locks cards and ends turn while checking if a pair has been chosen
            if (PickedCardsCount == 2)
            {
                CardClickAllowence(false);
                PickedCardsCount = 0;
                if (FunkcheckAdd.Checkpic())
                {
                    EndTurn(true);
                }
                else
                {
                    EndTurn(false);
                }
            }
        }
Ejemplo n.º 3
0
 private void timer5_Tick(object sender, EventArgs e)
 {
     if (timeLeftCard > 0)
     // if there's time left reduce time by 1 and update label every sec.
     {
         timeLeftCard = timeLeftCard - 1;
     }
     else
     // If time's up announce by changing label.
     {
         timer5.Stop();
         AIhard.NextCard();
     }
 }