using UnityEngine; namespace Soundings { internal sealed partial class DeckPassengers { private static void FitVenue(Venue room, Facility facility, float width, float depth, bool programVenue) { switch (facility) { case Facility.Suite: case Facility.GrandSuite: FitSuite(room, width, depth, facility == Facility.GrandSuite); break; case Facility.Restaurant: FitRestaurant(room, width, depth, programVenue); break; case Facility.GrandTheater: FitTheater(room, width, depth, programVenue); break; case Facility.ResortPool: FitPool(room, width, depth); break; case Facility.CocktailLounge: FitCocktailLounge(room, width, depth); break; } } private static void FitSuite(Venue room, float width, float depth, bool grand) { float bed = -width * .25f; float lounge = width * .25f; float bedDepth = Mathf.Min(depth * .16f, depth * .5f - .98f); float bedWidth = grand ? 2.18f : 1.92f; room.Box(Carpet, bed, .014f, 0, width * .37f, .018f, depth * .86f); room.Box(Brass, bed, .026f, -depth * .39f, width * .35f, .012f, .029f); room.Box(Brass, bed, .026f, depth * .39f, width * .35f, .012f, .029f); room.Solid(Joinery, bed, .28f, bedDepth, bedWidth, .56f, 1.98f); room.Box(Ivory, bed, .61f, bedDepth, bedWidth - .08f, .18f, 1.93f); room.Box(Marble, bed, .716f, bedDepth - .155f, bedWidth - .07f, .07f, 1.55f); room.Box(LoungeLeather, bed, .757f, bedDepth - .70f, bedWidth - .055f, .034f, .31f); room.Box(ShowVelvet, bed, 1.00f, bedDepth + .94f, bedWidth + .24f, .92f, .14f); room.Box(Brass, bed, 1.47f, bedDepth + .86f, bedWidth + .22f, .025f, .024f); for (int side = -1; side <= 1; side += 2) { float nightstand = bed + side * (bedWidth * .5f + .35f); room.Box(Ivory, bed + side * (.24f * bedWidth), .75f, bedDepth + .61f, .63f, .14f, .34f); room.Solid(Joinery, nightstand, .36f, bedDepth + .62f, .48f, .72f, .55f); room.Box(Marble, nightstand, .742f, bedDepth + .62f, .51f, .044f, .57f); room.Cylinder(Brass, nightstand, .765f, bedDepth + .62f, .18f, .031f); room.Cylinder(LightStrip, nightstand, .935f, bedDepth + .62f, .16f, .14f); } float sofa = depth * .29f; float sofaWidth = grand ? 2.94f : 2.26f; room.Box(Carpet, lounge, .014f, 0, width * .39f, .018f, depth * .82f); room.Solid(Joinery, lounge, .217f, sofa, sofaWidth, .42f, .67f); room.Box(LoungeLeather, lounge, .472f, sofa, sofaWidth, .13f, .67f); room.Box(LoungeLeather, lounge, .78f, sofa + .28f, sofaWidth, .49f, .13f); room.Box(Marble, lounge - sofaWidth * .32f, .58f, sofa + .13f, .36f, .17f, .26f); room.Box(ShowVelvet, lounge + sofaWidth * .32f, .58f, sofa + .12f, .34f, .17f, .26f); room.Solid(Joinery, lounge, .21f, -depth * .11f, 1.36f, .39f, .36f); room.Box(Marble, lounge, .424f, -depth * .11f, 1.43f, .058f, .42f); room.Box(Brass, lounge + .21f, .463f, -depth * .11f, .32f, .022f, .18f); room.Guest(GuestActivity.Read, lounge - sofaWidth * .18f, sofa, 25, OnboardService.Rooms, .18f, .475f, -1); float console = width * .445f; room.Solid(Joinery, console, .51f, depth * .28f, .66f, 1.02f, .69f); room.Box(Marble, console, 1.04f, depth * .28f, .70f, .045f, .72f); room.Box(Brass, console, .81f, depth * .14f, .27f, .034f, .042f); if (!grand) return; room.Solid(Joinery, -width * .447f, .44f, -depth * .10f, .70f, .88f, .70f); room.Box(Marble, -width * .447f, .909f, -depth * .10f, .74f, .058f, .75f); room.Box(9, -width * .447f, 1.08f, -depth * .10f, .23f, .29f, .19f); room.Guest(GuestActivity.Photograph, lounge + .45f, -depth * .33f, 56, OnboardService.Rooms, .56f, direction: -1); } private static void FitRestaurant(Venue room, float width, float depth, bool programVenue) { float tableZ = depth * .075f; float diningLine = tableZ + .76f; int tablesPerSide = Mathf.Clamp(Mathf.FloorToInt(width * .20f), 2, 3); room.Box(Carpet, 0, .015f, -depth * .28f, width * .93f, .019f, depth * .23f); room.Box(Brass, 0, .026f, -depth * .397f, width * .93f, .013f, .026f); for (int side = -1; side <= 1; side += 2) { for (int table = 0; table < tablesPerSide; table++) { float x = side * Mathf.Lerp(1.75f, width * .386f, table / (float)(tablesPerSide - 1)); room.Cylinder(Brass, x, .00f, tableZ, .72f, .085f); room.Solid(Marble, x, .758f, tableZ, 1.32f, .105f, .75f); room.Box(ShowVelvet, x, .821f, tableZ, 1.21f, .019f, .29f); room.Cylinder(LightStrip, x, .841f, tableZ - .14f, .09f, .052f); for (int seat = -1; seat <= 1; seat += 2) { float place = x + seat * .33f; room.Cylinder(Ivory, place, .838f, tableZ + .132f, .027f, .113f); room.Cylinder(PoolTile, place + .175f, .839f, tableZ + .19f, .094f, .035f); room.Seat(place, diningLine, ShowVelvet, -1); int variant = (side + 1) * 10 + table * 3 + seat + 1; room.Guest(GuestActivity.Dine, place, diningLine, variant, OnboardService.Meals, .14f + variant % 7 * .11f, ChairSeatHeight, -1); } } } if (programVenue) room.Guest(GuestActivity.Guitar, 0, depth * .36f, 45, OnboardService.Shows, .22f, direction: -1, program: EntertainmentProgram.LiveMusic); } private static void FitTheater(Venue room, float width, float depth, bool programVenue) { float stage = depth * .312f; float backdrop = depth * .462f; room.Box(ShowVelvet, 0, .017f, -depth * .19f, 1.57f, .031f, depth * .66f); room.Solid(Gasket, 0, .18f, stage, width * .80f, .36f, .96f); room.Box(Joinery, 0, .388f, stage, width * .81f, .056f, 1.00f); room.Box(Brass, 0, .369f, stage - .502f, width * .79f, .030f, .043f); room.Box(DeckTrim, 0, 1.38f, backdrop, width * .78f, 1.96f, .08f); room.Box(ShowVelvet, 0, 1.46f, backdrop - .059f, width * .68f, 1.75f, .065f); room.Box(Brass, 0, 2.15f, backdrop - .11f, width * .73f, .036f, .036f); for (int fold = -12; fold <= 12; fold++) { float x = fold * width * .026f; room.Cylinder(ShowVelvet, x, .43f, backdrop - .10f, 1.69f, .093f); if (fold % 4 == 0) room.Box(LightStrip, x, .434f, stage - .46f, .12f, .039f, .055f); } int seats = Mathf.Clamp(Mathf.FloorToInt(width * .26f), 4, 6); for (int row = 0; row < 2; row++) { for (int side = -1; side <= 1; side += 2) { for (int seat = 0; seat < seats; seat++) { float x = side * Mathf.Lerp(1.51f, width * .383f, seat / (float)(seats - 1)); float z = -depth * .15f - row * .63f; room.Seat(x, z, ShowVelvet); room.Box(Brass, x, .41f, z - .201f, .10f, .044f, .03f); room.Guest(GuestActivity.Watch, x, z, 57 + side * 13 + row * 7 + seat, OnboardService.Shows, .14f + seat * .09f + row * .17f, ChairSeatHeight); } } } room.Guest(GuestActivity.Perform, 0, stage, 81, OnboardService.Shows, .07f, direction: -1, lift: .42f); if (!programVenue) return; room.Guest(GuestActivity.Guitar, 0, stage, 82, OnboardService.Shows, .16f, direction: -1, lift: .42f, program: EntertainmentProgram.LiveMusic); for (int side = -1; side <= 1; side += 2) room.Guest(GuestActivity.Revue, side * width * .105f, stage, 90 + side, OnboardService.Shows, .18f, direction: -1, lift: .42f, program: EntertainmentProgram.Headline); } private static void FitPool(Venue room, float width, float depth) { float poolZ = depth * .115f; const float rim = .59f, surface = .47f; var basin = new Vector2(width * .337f, depth * .229f); room.Pool(poolZ, basin, rim, surface); room.Guest(GuestActivity.Wade, basin.x * .78f, poolZ + basin.y * .08f, 106, OnboardService.Amenities, .10f, lift: surface); room.Guest(GuestActivity.Wade, -basin.x * .77f, poolZ - basin.y * .12f, 108, OnboardService.Amenities, .48f, direction: -1, lift: surface); room.Swimmer(0, surface, poolZ - basin.y * .38f, basin.x * .70f, 111, .22f); room.Swimmer(.23f, surface, poolZ + basin.y * .37f, basin.x * .61f, 115, .52f); for (int side = -1; side <= 1; side += 2) { float x = side * width * .421f; float bench = depth * .10f; room.Solid(Joinery, x, .22f, bench, 1.38f, .44f, .62f); room.Box(Marble, x, .466f, bench, 1.41f, .052f, .65f); room.Box(LoungeLeather, x, .5f, bench, 1.30f, .055f, .57f); room.Box(LoungeLeather, x, .69f, bench + .28f, 1.31f, .36f, .07f); room.Box(Ivory, x + side * .44f, .55f, bench + .07f, .22f, .053f, .23f); room.Guest(GuestActivity.Rest, x - side * .14f, bench, 127 + side, OnboardService.Amenities, .29f, .485f, -1); } } private static void FitCocktailLounge(Venue room, float width, float depth) { float counter = depth * .13f; room.Solid(Joinery, 0, .49f, counter, width * .61f, .98f, .66f); room.Box(Marble, 0, 1.016f, counter, width * .63f, .074f, .74f); room.Box(Brass, 0, .884f, counter - .346f, width * .60f, .037f, .036f); room.Box(Brass, 0, .203f, counter - .381f, width * .59f, .040f, .039f); float display = depth * .454f; room.Box(DeckTrim, 0, 1.49f, display, width * .57f, .67f, .095f); room.Box(Joinery, 0, 1.306f, display - .075f, width * .58f, .066f, .24f); room.Box(LightStrip, 0, 1.81f, display - .07f, width * .57f, .047f, .15f); for (int bottle = -9; bottle <= 9; bottle++) { int variety = Mathf.Abs(bottle) % 4; float x = bottle * width * .026f; float bottleHeight = .14f + variety * .022f; room.Cylinder(variety is 1 or 3 ? PoolTile : LoungeLeather, x, 1.34f, display - .116f, bottleHeight, .034f); room.Cylinder(Brass, x, 1.33f + bottleHeight, display - .116f, .054f, .019f); } for (int side = -1; side <= 1; side += 2) { for (int seat = 0; seat < 3; seat++) { float x = side * Mathf.Lerp(1.24f, width * .265f, seat * .5f); float z = counter - .83f; room.Cylinder(Brass, x, .037f, z, .66f, .058f); room.Cylinder(Brass, x, .00f, z, .063f, .194f); room.Solid(LoungeLeather, x, .70f, z, .385f, .101f, .388f); room.Box(Brass, x, 1.057f, counter - .238f, .18f, .009f, .18f); room.Guest(GuestActivity.Drink, x, z, 141 + seat + side * 4, OnboardService.Drinks, .19f + seat * .16f, .774f); } room.Guest(GuestActivity.TendBar, side * width * .175f, counter + .717f, 171 + side, OnboardService.Drinks, .08f, direction: -1); float lounge = side * width * .402f; room.Solid(Joinery, lounge, .22f, depth * .15f, .75f, .44f, .52f); room.Box(Marble, lounge, .465f, depth * .15f, .83f, .051f, .60f); room.Seat(lounge, depth * .15f - .77f, LoungeLeather); room.Guest(GuestActivity.Drink, lounge, depth * .15f - .77f, 181 + side, OnboardService.Drinks, .50f, ChairSeatHeight); } } private readonly struct Venue { private readonly Geometry shape; private readonly Layout layout; private readonly Vector3 center; private readonly int facing, seed; public Venue(Geometry shape, Layout layout, Vector3 center, int facing, int seed) { this.shape = shape; this.layout = layout; this.center = center; this.facing = facing; this.seed = seed; } private Vector3 Point(float x, float y, float z) => center + new Vector3(x, y, z * facing); public void Box(int color, float x, float y, float z, float width, float height, float depth) => shape.Box(color, Point(x, y, z), new Vector3(width, height, depth)); public void Solid(int color, float x, float y, float z, float width, float height, float depth) { var size = new Vector3(width, height, depth); Vector3 point = Point(x, y, z); shape.Box(color, point, size); layout.WalkSpace.Block(point, size); } public void Cylinder(int color, float x, float floor, float z, float height, float radius) { Vector3 point = Point(x, floor, z); shape.Mesh(color).Rod(point, point + Vector3.up * height, radius, 12, true); } public void Seat(float x, float z, int color, int direction = 1) { Vector3 point = Point(x, 0, z); Chair(shape, point, color, facing * direction); layout.WalkSpace.Block(point, new Vector3(.50f, .91f, .54f)); } public void Guest(GuestActivity activity, float x, float z, int variant, OnboardService service, float occupancy, float seatHeight = 0, int direction = 1, float lift = 0, EntertainmentProgram? program = null) => AddGuest(layout, activity, Point(x, lift, z), seed * 11 + variant, facing * direction > 0 ? 0 : 180, (int)service, occupancy, seatHeight, program); public void Pool(float z, Vector2 basin, float rim, float surface) { Vector3 foot = Point(0, 0, z); VesselExterior.PoolBasin(shape.Mesh(Ivory), shape.Mesh(PoolTile), shape.Mesh(PoolWater), foot, basin, rim, surface); Vector3 ladder = Point(basin.x * .68f, .20f, z + basin.y - .07f); VesselExterior.PoolRails(shape.Mesh(Alloy), ladder, facing); layout.WalkSpace.Block(foot, new Vector3((basin.x + .23f) * 2f, rim, (basin.y + .23f) * 2f)); } public void Swimmer(float x, float y, float z, float halfLength, int variant, float occupancy) => AddGuest(layout, GuestActivity.Swim, Point(x, y, z), seed * 11 + variant, facing * 90, (int)OnboardService.Amenities, occupancy, swimHalfLength: halfLength); } } }