generateRelaxed() public method

public generateRelaxed ( int numPoints ) : List
numPoints int
return List
示例#1
0
    public void go(string pointType)
    {
        /* Place points... */
        reset();

        if (pointType == "Relaxed")
        {
            points = pointSelector.generateRelaxed(numPoints);
        }
        if (pointType == "Square")
        {
            points = pointSelector.generateSquare(numPoints);
        }
        if (pointType == "Hex")
        {
            points = pointSelector.generateHex(numPoints);
        }

        /* Build Graph... */
        var voronoi = new csDelaunay.Voronoi(points, new Rectf(0, 0, SIZE, SIZE));

        buildGraph(points, voronoi);
        voronoi.Dispose();
        voronoi = null;
        points  = null;
        improveCorners();

        recalcGraph(true);
    }
示例#2
0
    public void NewIsLand(IsLandShapeType islandType, PointType pointType, int numPoints, uint seed, uint variant)
    {
        switch (islandType)
        {
        case IsLandShapeType.Perlin:
            IslandShapeGen = IsLandShape.MakePerlin(seed);
            break;

        case IsLandShapeType.Radial:
            IslandShapeGen = IsLandShape.MakeRadial(seed);
            break;

        case IsLandShapeType.Square:
            IslandShapeGen = IsLandShape.MakeSquare(seed);
            break;

        default:
            break;
        }

        switch (pointType)
        {
        case PointType.Random:
            PointSelectorGen = PointSelector.generateRandom(MapSize, seed);
            break;

        case PointType.Relaxed:
            PointSelectorGen = PointSelector.generateRelaxed(MapSize, seed);
            break;

        case PointType.Square:
            PointSelectorGen = PointSelector.generateSquare(MapSize, seed);
            break;

        case PointType.Hexagon:
            PointSelectorGen = PointSelector.generateHexagon(MapSize, seed);
            break;

        default:
            break;
        }

        NeedsMoreRandomness = PointSelector.needsMoreRandomness(pointType);
        NumPoints           = numPoints;
        ParkMillerRng.Seed  = variant;
    }