コード例 #1
0
    private void OnMouseUpAsButton()
    {
        if (mine)
        {
            Playfield.UncoverMines();

            Debug.Log("Game Over");
        }
        else
        {
            int x = (int)transform.position.x;
            int y = (int)transform.position.y;
            LoadTexture(Playfield.CountAdjacentMines(x, y));

            Playfield.FloodFillUncover(x, y, new bool[Playfield.w, Playfield.h]);

            if (Playfield.IsFinished())
            {
                Debug.Log("You Win");
            }
        }
    }
コード例 #2
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");
            }
        }
    }