Esempio n. 1
0
 public static Building Generate(int floors, int rooms, int maxItemsPerRoom, int lootBias)
 {
     Building result = new Building();
     result.Floors = new Floor[floors];
     Random random = new Random(DateTime.Now.Millisecond);
     for (int f = 0; f < floors; f++)
     {
         Floor floor = new Floor(rooms, maxItemsPerRoom);
         floor.Populate(BuildingRandom, result, lootBias);
         result.Floors[f] = floor;
     }
     return result;
 }
Esempio n. 2
0
 public void Populate(Random random, Building building, int bias)
 {
     int rooms = Rooms.GetLength(0);
     int items = Rooms.GetLength(1);
     for (int r = 0; r < rooms; r++)
     {
         for (int i = 0; i < items; i++)
         {
             int val = random.Next(0, 100) + bias;
             val = (val >= 50) ? 1 : 0;
             building.TotalValue += val;
             Rooms[r, i] = val;
         }
     }
 }