Beispiel #1
0
        private void GenerateFinal()
        {
            // big room
            int roomY  = Data.GetLength(0) / 4;
            int roomY2 = 3 * Data.GetLength(0) / 4;
            int roomX  = Data.GetLength(1) / 4;
            int roomX2 = 3 * Data.GetLength(1) / 4;

            RoomPoints.Add(new List <int>(new int[] { roomY, roomX, roomY2, roomX2 }));
            for (int y = roomY; y < roomY2; ++y)
            {
                for (int x = roomX; x < roomX2; ++x)
                {
                    Data[y, x] = new RoomFloor(y, x, 0);
                }
            }
            for (int y = roomY - 1; y < roomY2 + 1; ++y)
            {
                for (int x = roomX - 1; x < roomX2 + 1; ++x)
                {
                    if (Data[y, x] == null)
                    {
                        Data[y, x] = new Wall(y, x);
                    }
                }
            }
            int entryY = roomY2;
            int entryX = (roomX + roomX2) / 2;

            Data[entryY, entryX] = new Stair(entryY, entryX, StairType.Up);
            Data[roomY, (roomX + roomX2) / 2].Inventory.AddItem(new Macguffin());
            Program.player.CoordX = entryX;
            Program.player.CoordY = entryY;
        }
Beispiel #2
0
 /// <summary> Places a room at the specified points. </summary>/summary>
 /// <param name="points"> The points of the room. </param>
 /// <param name="region"> The region to be used for the new room. </param>
 private void BuildRoom(List <int> points, int region)
 {
     for (int y = points[0]; y < points[2]; ++y)
     {
         for (int x = points[1]; x < points[3]; ++x)
         {
             Data[y, x] = new RoomFloor(y, x, region);
         }
     }
 }