Exemplo n.º 1
0
    // When the element is clicked
    private void OnMouseUpAsButton()
    {
        if (isMine)
        {
            Playfield.UncoverMines();
            print("You lose...");
        }
        else
        {
            // Checks ajdacents mines
            int x = (int)this.transform.position.x;
            int y = (int)this.transform.position.y;
            LoadTexture(Playfield.AdjacentMines(x, y));

            // Uncovers neighbors
            Playfield.FloodFillUncover(x, y, new bool[Playfield.Width, Playfield.Height]);

            if (Playfield.IsFinished())
            {
                print("You win");
            }
        }
    }