Example #1
0
        public GameBoard(GameDifficultyLevel difficultyLevel, Panel panel)
        {
            _random = new Random();
            _panel  = panel;
            switch (difficultyLevel)
            {
            case GameDifficultyLevel.Easy:
                _boardSize   = new[] { 8, 8 };
                _board       = new SingleField[_boardSize[0], _boardSize[1]]; //8x8 field
                NumberOfBomb = 10;
                break;

            case GameDifficultyLevel.Normal:
                _boardSize   = new[] { 16, 16 };
                _board       = new SingleField[_boardSize[0], _boardSize[1]]; // 16x16 field
                NumberOfBomb = 40;
                break;

            case GameDifficultyLevel.Hard:
                _boardSize   = new[] { 16, 30 };
                _board       = new SingleField[_boardSize[0], _boardSize[1]]; // 30x16 field
                NumberOfBomb = 99;
                break;
            }
            ArrangeTheBombs();
            BombsInTheNeighborhood();
        }
Example #2
0
 private void SetDifficultyLevel()
 {
     if (PlayerPrefs.HasKey(typeof(GameDifficultyLevel).ToString()))
     {
         _difficultyLevel = (GameDifficultyLevel)PlayerPrefs.GetInt(typeof(GameDifficultyLevel).ToString());
     }
     else
     {
         _difficultyLevel = GameDifficultyLevel.Normal;
     }
 }