Example #1
0
    public void Win(Unit.UnitSide player) // player will win the game
    {
        gameOver = true;
        HighlightDisable();
        GameOverMenu.SetActive(true);

        GameOverText.text = "Player " + ((int)player + 1) + " win!";
    }
Example #2
0
 void SwitchTurn()
 {
     if (playerTurn == Unit.UnitSide.Player1)
     {
         playerTurnText.text  = "Player 2 Turn";
         playerTurnText.color = new Color(0, 255, 255, 255);
         playerTurn           = Unit.UnitSide.Player2;
     }
     else
     {
         playerTurnText.text  = "Player 1 Turn";
         playerTurnText.color = new Color(0, 255, 107);
         playerTurn           = Unit.UnitSide.Player1;
     }
 }
Example #3
0
    void RestartGame()
    {
        // Restart variables
        selectedUnit = null;
        playerTurn   = Unit.UnitSide.Player1;
        gameOver     = false;


        GameBoard = new Unit[8, 8];          // Create new game board
        foreach (Unit unit in Unit.AllUnits) // Destroy all pieces that are left on the game board
        {
            Destroy(unit.GetGameObject);
        }
        Unit.AllUnits = new List <Unit>(); // Empty the list;
        CreateBoardPieces();               // Create all the pieces again for each player

        playerTurnText.text  = "Player 1 Turn";
        playerTurnText.color = new Color(10, 223, 108, 255);

        GameOverMenu.SetActive(false); // Display the game over popup
    }