예제 #1
0
    public override char[,] GenerateMap()
    {
        InitializePseudoRandomGenerator();

        width  = 0;
        height = 0;

        ParseGenome();

        InitializeMap();

        ProcessMap();

        map     = MapEdit.AddBorders(map, borderSize, wallChar);
        width  += borderSize * 2;
        height += borderSize * 2;

        if (createTextFile)
        {
            seed = seed.GetHashCode().ToString();
            SaveMapAsText();
        }

        return(map);
    }
예제 #2
0
    public override char[,] GenerateMap()
    {
        map = GetVoidMap();

        InitializePseudoRandomGenerator();

        RandomFillMap();

        for (int i = 0; i < smoothingIterations; i++)
        {
            SmoothMap();
        }

        ProcessMap();

        map    = MapEdit.AddBorders(map, borderSize, wallChar);
        width  = map.GetLength(0);
        height = map.GetLength(1);

        if (createTextFile)
        {
            SaveMapAsText();
        }

        return(map);
    }
    public override char[,] GenerateMap()
    {
        map = new char[width, height];

        InitializePseudoRandomGenerator();

        MapEdit.FillMap(map, wallChar);

        rooms       = new List <Room>();
        placedRooms = new List <Room>();

        if (createTextFile || prepareABExport)
        {
            ABRooms     = new List <ABRoom>();
            ABCorridors = new List <ABRoom>();
            ABTiles     = new List <ABTile>();
        }

        if (width > height)
        {
            DivideRoom(0, 0, width, height, true, 0);
        }
        else
        {
            DivideRoom(0, 0, width, height, false, 0);
        }

        ProcessRooms();

        ProcessMap();

        map    = MapEdit.AddBorders(map, borderSize, wallChar);
        width  = map.GetLength(0);
        height = map.GetLength(1);

        if (createTextFile || prepareABExport)
        {
            PopulateABRooms();
            PopulateABObjects();
            AddBorderToAB(borderSize);
        }
        if (createTextFile)
        {
            SaveMapAsText();
            SaveMapAsAB();
        }

        return(map);
    }
예제 #4
0
    // Generates a map.
    public override char[,] GenerateMap()
    {
        map = GetVoidMap();

        // Parse the genome if needed.
        if (useABGeneration)
        {
            ParseGenome();
        }
        if (tiles != null && tiles.Count > 0)
        {
            stairProbability = 0;
        }

        ValidateProbabilities();

        InitializePseudoRandomGenerator();

        MapEdit.FillMap(map, wallChar);

        DigMap();

        if (tiles != null && tiles.Count > 0)
        {
            foreach (ABTile t in tiles)
            {
                if (MapInfo.IsInMapRange(t.x, t.y, width, height))
                {
                    map[t.x, t.y] = t.value;
                }
            }
        }
        else
        {
            PopulateMap();
        }

        map    = MapEdit.AddBorders(map, borderSize, wallChar);
        width  = map.GetLength(0);
        height = map.GetLength(1);

        if (createTextFile && !useABGeneration)
        {
            SaveMapAsText();
        }

        return(map);
    }