void ModRooms() { foreach (LayoutObject room in Objects) { #region DEBUG double time = 0; if (BigBoss.Debug.logging(Logs.LevelGenMain)) { BigBoss.Debug.w(Logs.LevelGenMain, "Mods for " + room); } if (BigBoss.Debug.logging(Logs.LevelGen)) { BigBoss.Debug.CreateNewLog(Logs.LevelGen, "Level Depth " + Depth + "/" + Depth + " " + 0 + " - Generate Room " + room.Id); BigBoss.Debug.printHeader(Logs.LevelGen, "Modding " + room); time = Time.realtimeSinceStartup; } #endregion Theme.ChooseAllSmartObjects(Rand); RoomSpec spec = new RoomSpec(room, Depth, Theme, Rand); // Base Mod if (!ApplyMod(spec, spec.RoomModifiers.BaseMods)) { throw new ArgumentException("Could not apply base mod"); } // Definining Mod if (spec.RoomModifiers.AllowDefiningMod) { ApplyMod(spec, spec.RoomModifiers.DefiningMods); } // Flex Mods int numFlex = Rand.Next(spec.RoomModifiers.MinFlexMods, spec.RoomModifiers.MaxFlexMods); int numHeavy = (int)Math.Round((numFlex / 3d) + (numFlex / 3d * Rand.NextDouble())); int numFill = numFlex - numHeavy; // Heavy Mods for (int i = 0; i < numHeavy; i++) { if (!ApplyMod(spec, spec.RoomModifiers.HeavyMods)) { break; } } // Fill Mods for (int i = 0; i < numFill; i++) { if (!ApplyMod(spec, spec.RoomModifiers.FillMods)) { break; } } // Final Mods ApplyMod(spec, spec.RoomModifiers.FinalMods); #region DEBUG if (BigBoss.Debug.logging(Logs.LevelGen)) { room.ToLog(Logs.LevelGen); BigBoss.Debug.w(Logs.LevelGen, "Modding " + room + " took " + (Time.realtimeSinceStartup - time) + " seconds."); BigBoss.Debug.printFooter(Logs.LevelGen, "Modding " + room); } #endregion if (!ValidateRoom(room)) { throw new ArgumentException(room + " is not valid."); } } #region DEBUG if (BigBoss.Debug.logging(Logs.LevelGenMain)) { foreach (LayoutObject room in Objects) { room.ToLog(Logs.LevelGenMain); } } #endregion }