コード例 #1
0
ファイル: SewerBossLevel.cs プロジェクト: zvinch/SharpDungeon
 protected internal override bool[] Grass()
 {
     return(Patch.Generate(0.40f, 4));
 }
コード例 #2
0
ファイル: SewerBossLevel.cs プロジェクト: zvinch/SharpDungeon
 protected internal override bool[] Water()
 {
     return(Patch.Generate(0.5f, 5));
 }
コード例 #3
0
 protected internal override bool[] Water()
 {
     return(Patch.Generate(feeling == Feeling.WATER ? 0.65f : 0.45f, 4));
 }
コード例 #4
0
 protected internal override bool[] Grass()
 {
     return(Patch.Generate(feeling == Feeling.GRASS ? 0.60f : 0.40f, 3));
 }
コード例 #5
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);
        }