//Go to game
 private void NextTurn()
 {
     moves         = MOVES_IN_TURN;
     currentPlayer = -currentPlayer;
     if (currentPlayer != 1)
     {
         if (!player2.GetComponent <PlayerScript>().IsDead)
         {
             if (playersNumber != 1)
             {
                 gameView.UpdatePowerPointsView(elementsPowerPoints2, moves);
                 gameView.SetUpGamePanel();
             }
             else
             {
                 gameView.UpdatePowerPointsView(elementsPowerPoints2, moves);
                 gameView.SetUpGamePanel();
                 grid.BlockGrid(false, gameView.GetGameGrid(), CELL_COUNT);
                 StartCoroutine(EnemyCoroutine());
             }
         }
         else
         {
             GameOver();
         }
     }
     else
     {
         if (!player.GetComponent <PlayerScript>().IsDead)
         {
             gameView.UpdatePowerPointsView(elementsPowerPoints, moves);
             gameView.SetUpGamePanel();
         }
         else
         {
             GameOver();
         }
     }
 }
Ejemplo n.º 2
0
    public void ButtonAction(GameObject button)
    {
        int index = gameButtonList.IndexOf(button);

        if (modelScr.IsFieldFree(index))
        {
            modelScr.FillField(player, index);
            button.GetComponent <Button>().image.sprite = img;
            int winner = modelScr.CheckWin();
            if (winner != 0)
            {
                gridScr.BlockGrid(gameButtonList);
                StartCoroutine(ShowWinner(winner));
            }
            ChangePlayer(player);
        }
    }