private static void AddCommonSpaceSideFurnishing(CommonSpace room, string[,,] grid) { var population = room.inhabitants.Count; var size = Mathf.Sqrt(DesignedBuilding.monsterRoomSizes[room.inhabitants[0].generalType]); int bedType = ActiveCastleLivingQuartersGen.GetBedType(room); if (bedType == 1) { population /= 2; } bool fancy = (bedType >= 6); population /= 2; Dictionary <string, GameObject> furniture; Dictionary <string, float> furnitureProbs; if (fancy) { furniture = prefabs["castle"]["commonSpaceSideFurnitureFancy"]; furnitureProbs = prefabProbability["castle"]["commonSpaceSideFurnitureFancy"]; } else { furniture = prefabs["castle"]["commonSpaceSideFurniture"]; furnitureProbs = prefabProbability["castle"]["commonSpaceSideFurniture"]; } var potentialSpots = LevelGenRoomUtils.GetPotentialSideDressingSpots(room, grid); foreach (var spot in potentialSpots) { var roll = Random.Range(0, 100); if (roll < 100 * population / (float)potentialSpots.Count) { var xFudge = Random.Range(-0.05f, 0.05f); var yFudge = Random.Range(-0.05f, 0.05f); var rotationFudge = Random.Range(-2.5f, 2.5f); var wallRotation = LevelGenGridUtils.GetWallRotation((int)spot.x, (int)spot.y, room.floor, grid); var xAdjust = LevelGenGridUtils.GetXSideDressingAdjustment((int)spot.x, (int)spot.y, room.floor, grid); var yAdjust = LevelGenGridUtils.GetYSideDressingAdjustment((int)spot.x, (int)spot.y, room.floor, grid); var obj = LevelGenInstantiationUtils.InstantiateBlockObject(furniture, furnitureProbs, xAdjust + xFudge + spot.x, yAdjust + yFudge + spot.y); room.dressingLocations.Add(spot); obj.transform.localScale = new Vector3(size, size, size); obj.transform.Rotate(0, rotationFudge + wallRotation, 0); } } }