Ejemplo n.º 1
0
    public void Generate()
    {
        GridSystem grid = new GridSystem();

        List <PositionedShape> shapes = spec.ToShapes();

        // run solving algorithm
        bool solvable = GraphGenerator.AttemptPosition(ref shapes, 50000, grid, spec.blockerPortion);

        if (solvable)
        {
            MakeLevelFromShapes(shapes, spec.extraEdges, levelName);
        }
    }
Ejemplo n.º 2
0
    public void GenerateMany()
    {
        GridSystem grid = new GridSystem();

        List <PositionedShape> shapes = spec.ToShapes();

        LevelSet set = new LevelSet();

        for (int i = 0; i < n; i++)
        {
            // run solving algorithm
            bool solvable = GraphGenerator.AttemptPosition(ref shapes, 50000, grid, spec.blockerPortion);

            if (solvable)
            {
                Level level = MakeLevelFromShapes(shapes, spec.extraEdges, string.Format(levelNameFormat, i));
                set.levels.Add(level);
            }
        }

        string assetPath = Path.Combine("Assets/Objects/LevelSets", string.Format("{0}.asset", levelSetName));

        AssetDatabase.CreateAsset(set, assetPath);
    }