Exemplo n.º 1
0
        public IEnumerator BuildGrid()
        {
            totalCellCount = 0;
            grid           = PointyHexGrid <TileCell> .Rectangle(width, height);

            map = new PointyHexMap(new Vector2(69, 80) * 3)
                  .To3DXY();

            int cellCount = 0;

            foreach (var point in grid)
            {
                var     cell       = Instantiate(cellPrefab);
                Vector3 worldPoint = map[point];

                cell.transform.localPosition = worldPoint;

                cellCount++;
                totalCellCount++;

                grid[point] = cell;

                if (cellCount >= cellsPerIteration)
                {
                    cellCount = 0;
                    yield return(null);
                }
            }
        }