예제 #1
0
파일: Block.cs 프로젝트: Liljan/Minesweeper
    private void OnMouseOver()
    {
        if (Input.GetMouseButtonDown(Mouse.LEFT) && !isFlagged && isCovered)
        {
            if (isMine)
            {
                gm.UnCoverMines();

                Debug.Log("DEATH!");
            }
            else
            {
                SetSpriteNumber(gm.AdjacentMines(indX, indY));

                gm.FloodFillUncover(indX, indY, new bool[gm.w, gm.h]);

                if (gm.IsFinished())
                {
                    Debug.Log("Victory. Dumbass.");
                }
            }
        }
        else if (Input.GetMouseButtonDown(Mouse.RIGHT) && isCovered)
        {
            if (!isFlagged)
            {
                SetSpriteFlag();
                isFlagged = true;
            }
            else
            {
                SetSpriteDefault();
                isFlagged = false;
            }
        }
    }