コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: mdmooney/WorldGen
        private void DrawHexMap(HexMap map, Func <Coords, Color> colorMethod, Double scale = DEFAULT_SCALE)
        {
            Point offset = GetHexagonOffsets();

            double x = 0.0;
            double y = 0.0;

            for (int i = 0; i < map.Width; i++)
            {
                x += scale + offset.X;
                y  = (i % 2 != 0) ? offset.Y : 0.0;
                for (int j = 0; j < map.Height; j++)
                {
                    y += (offset.Y * 2);
                    Coords     currCoords = new Coords(i, j);
                    MapHexagon newMapHex  = CreateHexagon(x, y, colorMethod(currCoords), currCoords);
                    newMapHex.ChangeColor(map.BaseColorAt(currCoords));
                    MapHexagons.Add(newMapHex);
                    if (map.IsRiverAt(currCoords))
                    {
                        RiverSegment seg   = map.GetMainRiverSegmentAt(currCoords);
                        Hex.Side?    entry = seg.EntrySide;
                        Hex.Side?    exit  = seg.ExitSide;
                        //DrawRiver(x, y, entry, exit, scale);
                        DrawRivers();
                    }
                }
            }
        }
コード例 #2
0
 public World(int width, int height)
 {
     Width           = width;
     Height          = height;
     Map             = new HexMap(RandomGenerator, width, height);
     _demographics   = new Dictionary <Coords, Demographics>();
     Rivers          = new List <River>();
     RandomGenerator = new RandomGen();
 }
コード例 #3
0
ファイル: LayeredExpander.cs プロジェクト: mdmooney/WorldGen
 /**
  * <summary>
  * Constructor for LayeredExpander takes the map to alter.
  * </summary>
  * <param name="map">The HexMap to update.</param>
  */
 public LayeredExpander(IRandomGen rand, HexMap map) : base(rand, map)
 {
     _alreadyModified = new List <Coords>();
 }
コード例 #4
0
 public BiomeExpander(IRandomGen rand, HexMap map, BiomeList biomes) : base(rand, map)
 {
     _biomes = biomes;
 }
コード例 #5
0
ファイル: RaceGen.cs プロジェクト: mdmooney/WorldGen
 public RaceGen(HexMap map)
 {
     _map = map;
     CreatePrototypes();
 }
コード例 #6
0
ファイル: HumidityExpander.cs プロジェクト: mdmooney/WorldGen
 /**
  * <summary>
  * Constructor for HumidityExpander takes the map to alter.
  * </summary>
  * <param name="map">The HexMap to update.</param>
  */
 public HumidityExpander(IRandomGen rand, HexMap map) : base(rand, map)
 {
 }
コード例 #7
0
        // ------------ Concrete methods ------------

        /**
         * <summary>
         * Sole constructor of a HexExpander just takes the HexMap which will be
         * altered by the hex expansion, and a random number generator.
         * </summary>
         */
        protected HexExpander(IRandomGen rand, HexMap map)
        {
            _rand = rand;
            _map  = map;
        }