Example #1
0
        public void NewGame(FieldConfig fieldConfig)
        {
            if (_victoryManager != null && _victoryManager == fieldConfig.VictoryManager)
            {
                Unsubscribe();
            }

            _victoryManager   = fieldConfig.VictoryManager;
            _minerFieldFiller = fieldConfig.FieldFiller;

            SizeX = fieldConfig.SizeX;
            SizeY = fieldConfig.SizeY;

            MineCount = fieldConfig.MinesCount;
            _field    = new Field(fieldConfig);
            _victoryManager.SetField(_field);
            _field.MinesStateChanged += VictoryManager_CheckCompleted;
            _victoryManager.GameOver += VictoryManager_GameOver;
            _victoryManager.Victory  += VictoryManager_Victory;
            _isNewGame = true;
            NewGameStart?.Invoke(this, null);
        }