Пример #1
0
        /// <summary>
        /// Creates a country with a name and list of cell columns and rows.
        /// </summary>
        /// <returns>The country index.</returns>
        int CreateHexCountry(string name, int[,] cells)
        {
            // 1) Create the empty country
            int countryIndex = map.CountryCreate("My country", "Continent");

            // 2) Add cells to the country, building its frontiers
            for (int k = 0; k < cells.Length / 2; k++)
            {
                int cellIndex = map.GetCellIndex(cells[k, 0], cells[k, 1]);
                map.CountryTransferCell(countryIndex, cellIndex, false);                 // false = don't redraw because we'll redraw only once when all cells are added
            }

            // 3) Update the map
            map.Redraw();

            return(countryIndex);
        }