Example #1
0
    public LevelData(int width,int height, double seed, int theType)
    {
        this.seed = seed;
        r = new RandomSeed(seed);

        //SET THE COLOR FOR MY ASCII TEXT THING
        UColor.HSL theMainColor = new UColor.HSL((float)r.getRandom(),0.7f,0.3f); //Choose a main color
        MainColor = theMainColor.toColor();

        this.width = width;
        this.height = height;
        type = theType;
        md = new AsciiMapSymbols(type, MainColor);
        astar = new AStar(this.width, this.height);

        this.startLocation = new Vector2(width/2, height/2);
        this.parentStartLocation = startLocation;
        clearTo(0);
    }
Example #2
0
    public override void generate()
    {
        clearTo(AsciiMapSymbols.WALKABLE); // SET IT ALL TO (WALKABLE) TO START

        int numRooms = Mathf.Max(width / 10, height/10);
        int maxRoomSize = numRooms - 2;
        int minRoomSize = 3;

        maxRoomSize = Mathf.Clamp(maxRoomSize, minRoomSize, maxRoomSize);

        PseudoLinearLevel psl =
                new PseudoLinearLevel((uint)width,(uint)height,(uint)numRooms,
                                        (uint)minRoomSize,(uint)maxRoomSize,
                                        (uint)minRoomSize,(uint)maxRoomSize,
                                        1,1,r,4); //This line isn't really useful but has to be here

        createStartingCaveMap(psl);

        placeGaps(10);

        RandomFill(-1, AsciiMapSymbols.WALKABLE, r.getIntInRange(15,25));

        OutlineMap(BASELAYER,AsciiMapSymbols.MOUNTAIN); // Outline the map with a blocking or warping tile

        placeTreasure(r.getIntInRange(1,numRooms/2), 4, psl); // UPDATE THIS TO TAKE ADVANTAGE OF THE PSL INFORMATION

        placeExitArea(r.getIntInRange(4,6)); //The start is a safe zone.

        updateCollision();

        //SET THE COLOR FOR THE ASCII TEXT THING
        UColor.HSL theMainColor = new UColor.HSL((float)r.getRandom(),0.7f,0.3f); //Choose a main color
        MainColor = theMainColor.toColor();
        md = new AsciiMapSymbols(LevelData.TYPE_CAVE, MainColor);

        base.generate();
    }