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(); } } } }
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(); }
/** * <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>(); }
public BiomeExpander(IRandomGen rand, HexMap map, BiomeList biomes) : base(rand, map) { _biomes = biomes; }
public RaceGen(HexMap map) { _map = map; CreatePrototypes(); }
/** * <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) { }
// ------------ 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; }