예제 #1
0
 private void NewWorldClick(object sender, RoutedEventArgs e)
 {
     MapHexagons.Clear();
     MapRivers.Clear();
     GenerateNewWorld(MaxX, MaxY);
     DrawHexMap(_world.Map, _world.Map.BaseColorAt);
 }
예제 #2
0
        private void DrawRivers(Double scale = DEFAULT_SCALE)
        {
            foreach (var river in _world.Rivers)
            {
                RiverSegment seg = river.FirstSeg;
                MapRiver     mr  = new MapRiver();

                mr.Points.Add(CenterPointFromCoords(seg.Location));

                while ((seg.NextSegment != null))
                {
                    if (CoordsWrap(seg.Location, seg.NextSegment.Location))
                    {
                        Point loc       = PointFromCoords(seg.Location);
                        Point exitPoint = GetCoordsOfSideMidpoint(loc.X, loc.Y, (Hex.Side)seg.ExitSide);
                        mr.Points.Add(exitPoint);
                        MapRivers.Add(mr);
                        mr  = new MapRiver();
                        loc = PointFromCoords(seg.NextSegment.Location);
                        Point entryPoint = GetCoordsOfSideMidpoint(loc.X, loc.Y, (Hex.Side)seg.NextSegment.EntrySide);
                        mr.Points.Add(entryPoint);
                    }
                    seg = seg.NextSegment;
                    mr.Points.Add(CenterPointFromCoords(seg.Location));
                }

                if (river.LastSeg.ExitSide != null)
                {
                    Hex.Side exitSide     = (Hex.Side)river.LastSeg.ExitSide;
                    Point    loc          = PointFromCoords(river.LastSeg.Location);
                    Point    sideMidpoint = GetCoordsOfSideMidpoint(loc.X, loc.Y, exitSide);
                    mr.Points.Add(sideMidpoint);
                }

                MapRivers.Add(mr);
            }
        }