예제 #1
0
    /// <summary>
    /// Mechanic for Clicking on a tile
    /// </summary>
    public void ClickTile()
    {
        //  If game has not been started yet
        if (!minefield.hasGameStarted)
        {
            minefield.hasGameStarted = true;

            CreateMines();
            minefield.timer.StartTimer();
        }

        //  If the tile is a mine --> end of the game
        if (tile.isMine)
        {
            minefield.LoseGame();
            return;
        }

        //  Reveal all nearby tiles
        RevealTile();

        //  Check if game is won
        if (minefield.IsGameWon())
        {
            minefield.WinGame();
        }
    }
    void ClickTile()
    {
        // Check if game started
        if (!minefield.hasGameStarted)
        {
            minefield.hasGameStarted = true;

            this.CreateMines();
            minefield.timer.StartTimer();
        }

        if (tile.isMine)
        {
            minefield.LoseGame();
        }
        else
        {
            RevealTile();

            if (minefield.IsGameWon())
            {
                minefield.WinGame();
            }
        }
    }
예제 #3
0
    // What happens when you click a tile
    void ClickTile()
    {
        // Setup the game if it hasnt started yet.
        if (!minefield.gameStarted)
        {
            minefield.gameStarted = true;

            //spriteController.SetDefaultSprite();

            // make mines
            this.CreateMines();
        }

        // Do stuff if game is live
        if (tile.isMine)
        {
            minefield.LoseGame(1);
        }
        else
        {
            RevealTile();
            if (minefield.IsGameWon())
            {
                minefield.WinGame();
            }
        }
    }