Exemplo n.º 1
0
        protected override bool Build()
        {
            for (var i = 0; i < 5; i++)
            {
                var top    = Random.IntRange(2, RoomTop - 1);
                var bottom = Random.IntRange(RoomBottom + 1, 22);
                Painter.Fill(this, 2 + i * 4, top, 4, bottom - top + 1, Terrain.EMPTY);

                if (i == 2)
                {
                    exit = (i * 4 + 3) + (top - 1) * Width;
                }

                for (var j = 0; j < 4; j++)
                {
                    if (Random.Int(2) != 0)
                    {
                        continue;
                    }

                    var y = Random.IntRange(top + 1, bottom - 1);
                    map[i * 4 + j + y * Width] = Terrain.WALL_DECO;
                }
            }

            map[exit] = Terrain.LOCKED_EXIT;

            Painter.Fill(this, RoomLeft - 1, RoomTop - 1, RoomRight - RoomLeft + 3, RoomBottom - RoomTop + 3, Terrain.WALL);
            Painter.Fill(this, RoomLeft, RoomTop, RoomRight - RoomLeft + 1, RoomBottom - RoomTop + 1, Terrain.EMPTY);

            entrance      = Random.Int(RoomLeft + 1, RoomRight - 1) + Random.Int(RoomTop + 1, RoomBottom - 1) * Width;
            map[entrance] = Terrain.ENTRANCE;

            var patch = Patch.Generate(0.45f, 6);

            for (var i = 0; i < Length; i++)
            {
                if (map[i] == Terrain.EMPTY && patch[i])
                {
                    map[i] = Terrain.WATER;
                }
            }

            return(true);
        }
Exemplo n.º 2
0
 protected internal override bool[] Grass()
 {
     return(Patch.Generate(feeling == Feeling.GRASS ? 0.55f : 0.30f, 3));
 }
Exemplo n.º 3
0
 protected internal override bool[] Water()
 {
     return(Patch.Generate(feeling == Feeling.WATER ? 0.55f : 0.40f, 6));
 }
Exemplo n.º 4
0
 protected internal override bool[] Grass()
 {
     return(Patch.Generate(0.30f, 4));
 }
Exemplo n.º 5
0
 protected internal override bool[] Water()
 {
     return(Patch.Generate(0.45f, 5));
 }
Exemplo n.º 6
0
        protected override bool Build()
        {
            var topMost = int.MaxValue;

            for (var i = 0; i < 8; i++)
            {
                int left, right, top, bottom;
                if (Random.Int(2) == 0)
                {
                    left  = Random.Int(1, ROOM_LEFT - 3);
                    right = ROOM_RIGHT + 3;
                }
                else
                {
                    left  = ROOM_LEFT - 3;
                    right = Random.Int(ROOM_RIGHT + 3, Width - 1);
                }
                if (Random.Int(2) == 0)
                {
                    top    = Random.Int(2, ROOM_TOP - 3);
                    bottom = ROOM_BOTTOM + 3;
                }
                else
                {
                    top    = ROOM_LEFT - 3;
                    bottom = Random.Int(ROOM_TOP + 3, Height - 1);
                }

                Painter.Fill(this, left, top, right - left + 1, bottom - top + 1, Terrain.EMPTY);

                if (top >= topMost)
                {
                    continue;
                }

                topMost = top;
                exit    = Random.Int(left, right) + (top - 1) * Width;
            }

            map[exit] = Terrain.LOCKED_EXIT;

            for (var i = 0; i < Length; i++)
            {
                if (map[i] == Terrain.EMPTY && Random.Int(6) == 0)
                {
                    map[i] = Terrain.INACTIVE_TRAP;
                }
            }

            Painter.Fill(this, ROOM_LEFT - 1, ROOM_TOP - 1, ROOM_RIGHT - ROOM_LEFT + 3, ROOM_BOTTOM - ROOM_TOP + 3, Terrain.WALL);
            Painter.Fill(this, ROOM_LEFT, ROOM_TOP + 1, ROOM_RIGHT - ROOM_LEFT + 1, ROOM_BOTTOM - ROOM_TOP, Terrain.EMPTY);

            Painter.Fill(this, ROOM_LEFT, ROOM_TOP, ROOM_RIGHT - ROOM_LEFT + 1, 1, Terrain.TOXIC_TRAP);

            arenaDoor      = Random.Int(ROOM_LEFT, ROOM_RIGHT) + (ROOM_BOTTOM + 1) * Width;
            map[arenaDoor] = Terrain.DOOR;

            entrance      = Random.Int(ROOM_LEFT + 1, ROOM_RIGHT - 1) + Random.Int(ROOM_TOP + 1, ROOM_BOTTOM - 1) * Width;
            map[entrance] = Terrain.ENTRANCE;

            var patch = Patch.Generate(0.45f, 6);

            for (var i = 0; i < Length; i++)
            {
                if (map[i] == Terrain.EMPTY && patch[i])
                {
                    map[i] = Terrain.WATER;
                }
            }

            return(true);
        }