public override void PlaceBombs(ref GridNode[,] matrix)
        {
            int placedBombs = 0;

            while (placedBombs < maxBombsCount)
            {
                var randomLower = Random.Range(0, matrix.GetUpperBound(0));
                var randomUpper = Random.Range(0, matrix.GetUpperBound(0));
                var node        = matrix[randomLower, randomUpper];
                node.containsBomb = true;
                placedBombs++;
            }
        }
        private void RevealNodesRecursive(GridNode node)
        {
            if (node.currentState == EGridNodeState.Revealed || node.currentState == EGridNodeState.Flagged)
            {
                return;
            }

            var ij = node.position;

            int minX = Math.Max(ij.x - 1, _nodesMatrix.GetLowerBound(0));
            int maxX = Math.Min(ij.x + 1, _nodesMatrix.GetUpperBound(0));
            int minY = Math.Max(ij.y - 1, _nodesMatrix.GetLowerBound(1));
            int maxY = Math.Min(ij.y + 1, _nodesMatrix.GetUpperBound(1));

            List <GridNode> candidates            = new List <GridNode>();
            bool            shouldCheckCandidates = true;

            for (int x = minX; x <= maxX; x++)
            {
                for (int y = minY; y <= maxY; y++)
                {
                    var candidate = _nodesMatrix[x, y];
                    if (candidate.containsBomb)
                    {
                        node.adjacentBombs++;
                        shouldCheckCandidates = false;
                    }
                    else
                    {
                        candidates.Add(candidate);
                    }
                }
            }
            node.ChangeState(EGridNodeState.Revealed);
            _uncheckedNodes.Remove(node);

            if (shouldCheckCandidates)
            {
                foreach (var candidate in candidates)
                {
                    candidate.requiresDelayForDrawing = true;
                    RevealNodesRecursive(candidate);
                }
            }
        }