private void CreateBubblesInGrid()
        {
            var       boardSize        = _contexts.game.boardSize.Value;
            const int firstRowsCount   = 6;
            const int ceilingRowsCount = 4;
            var       ceilingCoords    = new HashSet <AxialCoord>();

            for (var r = 0; r < boardSize.y; r++)
            {
                var rOffset = r >> 1;
                for (var q = -rOffset; q < boardSize.x - rOffset; q++)
                {
                    if (boardSize.y - r <= firstRowsCount)
                    {
                        var axialCoord = new AxialCoord {
                            Q = q, R = r
                        };
                        BubbleCreatorService.CreateBoardBubble(axialCoord,
                                                               BubbleCreatorService.GenerateRandomBubbleNumber());
                    }

                    if (boardSize.y - r <= ceilingRowsCount)
                    {
                        ceilingCoords.Add(new AxialCoord {
                            Q = q, R = r
                        });
                    }
                }
            }

            _contexts.game.SetCeilingCoords(ceilingCoords);
        }
Exemplo n.º 2
0
        private void FillRow(int r, int width, GameEntity[,] hexMap)
        {
            var rOffset = r / 2;

            for (var q = -rOffset; q < width - rOffset; q++)
            {
                var axialCoord = new AxialCoord {
                    Q = q, R = r
                };

                var indices = HexHelperService.GetArrayIndices(axialCoord);

                if (hexMap[indices.x, indices.y] != null)
                {
                    continue;
                }

                BubbleCreatorService.CreateBoardBubble(axialCoord,
                                                       BubbleCreatorService.GenerateRandomBubbleNumber());
            }
        }