Exemplo n.º 1
0
    /// <summary>
    /// Begin game session.
    /// </summary>
    private void StartGame()
    {
        gameStarted = true;

        movesMade = new List <PlayerMoveEntry>(); // Restart bookkeeping list.

        mainGrid.InitializeGrid(Overseer.GameGridSize);
        mainGrid.InitializeTiles();

        // Set player symbols.
        if (playerUISymbols[0] != null)
        {
            playerUISymbols[0].sprite = Overseer.GamePlayerSymbols[0];
        }
        if (playerUISymbols[1] != null)
        {
            playerUISymbols[1].sprite = Overseer.GamePlayerSymbols[1];
        }

        players[0].playerSymbol = Overseer.GamePlayerSymbols[0];
        players[1].playerSymbol = Overseer.GamePlayerSymbols[1];

        // Choose a random player to go first.
        currentPlayerIndex = (int)Random.Range(0, 2);
        currentTurn        = players[currentPlayerIndex];
        ChangeTurnDisplay();
        // Stop displaying end game panel and display current turn.
        EndGamePanel.gameObject.SetActive(false);
        turnDisplay.gameObject.SetActive(true);

        // Initialize game state
        gameState = GameState.Game;

        if (debugMode == true)
        {
            debugText.gameObject.SetActive(true);
        }
        else
        {
            debugText.gameObject.SetActive(false);
        }
    }