486 lines
26 KiB
C#
486 lines
26 KiB
C#
using UnityEngine;
|
|
|
|
namespace BigShipTycoon
|
|
{
|
|
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);
|
|
FitPoolSurround(room, poolZ, basin);
|
|
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 static void FitRetailArcade(Geometry shape, Layout layout, DeckGrid grid,
|
|
System.Collections.Generic.IReadOnlyList<Vector2Int> footprint, int col, int row, float floor, int rotation, int seed)
|
|
{
|
|
for (int i = 0; i < footprint.Count; i++)
|
|
{
|
|
Vector2Int offset = footprint[i];
|
|
int bayRow = row + offset.y;
|
|
var center = new Vector3(grid.Center(col + offset.x), floor + .06f, grid.Row(bayRow));
|
|
float width = grid.CellWidth - .19f, depth = grid.RowDepth - .18f;
|
|
if ((rotation & 1) != 0)
|
|
(width, depth) = (depth, width);
|
|
var wing = new Venue(shape, layout, center, bayRow == 0 ? -1 : 1, seed + i * 13, rotation);
|
|
FitRetail(wing, width, depth, offset == Vector2Int.zero, i);
|
|
}
|
|
}
|
|
|
|
private static void FitNewVenue(Venue room, Facility facility, float width, float depth)
|
|
{
|
|
if (facility == Facility.Shop)
|
|
FitRetail(room, width, depth, true, 0);
|
|
else
|
|
FitWellness(room, width, depth, facility == Facility.WaterPark);
|
|
}
|
|
|
|
private static void FitRetail(Venue room, float width, float depth, bool checkout, int selection)
|
|
{
|
|
float displayX = width * .235f;
|
|
float displayZ = depth * .30f;
|
|
float shelfWidth = Mathf.Min(width * .29f, 2.36f);
|
|
float shelfDepth = Mathf.Min(.40f, depth * .115f);
|
|
room.Box(Carpet, 0, .012f, -depth * .08f, width * .89f, .023f, depth * .50f);
|
|
room.Box(Brass, 0, .024f, -depth * .335f, width * .89f, .015f, .034f);
|
|
room.Solid(Joinery, displayX, .21f, displayZ, shelfWidth, .42f, shelfDepth);
|
|
room.Solid(Joinery, displayX, 1.11f, displayZ + shelfDepth * .41f, shelfWidth, 1.42f, .079f);
|
|
room.Box(Brass, displayX, 1.846f, displayZ, shelfWidth + .07f, .055f, shelfDepth + .047f);
|
|
room.Box(LightStrip, displayX, 1.791f, displayZ - shelfDepth * .41f, shelfWidth * .96f, .024f, .06f);
|
|
for (int level = 0; level < 3; level++)
|
|
{
|
|
float y = .49f + level * .42f;
|
|
room.Solid(Ivory, displayX, y, displayZ, shelfWidth + .07f, .055f, shelfDepth + .035f);
|
|
for (int item = 0; item < 4; item++)
|
|
{
|
|
float x = displayX + (item - 1.5f) * shelfWidth * .227f;
|
|
int color = ((item + level + selection) % 4) switch
|
|
{
|
|
0 => ShowVelvet, 1 => LoungeLeather, 2 => PoolTile, _ => Ivory
|
|
};
|
|
float packWidth = Mathf.Min(.27f, shelfWidth * .182f);
|
|
float height = level == 2 ? .15f + item % 2 * .055f : .095f + item % 3 * .064f;
|
|
room.Box(color, x, y + .027f + height * .5f, displayZ - .045f, packWidth, height, shelfDepth * .67f);
|
|
room.Box(Brass, x, y + .045f + height * .63f, displayZ - shelfDepth * .37f - .045f, packWidth * .52f, .025f, .014f);
|
|
}
|
|
}
|
|
room.Guest(GuestActivity.Shopper, displayX, displayZ - .62f, 17, OnboardService.Retail, .24f);
|
|
|
|
float counterX = -width * .232f;
|
|
float counterZ = checkout ? depth * .035f : depth * .25f;
|
|
float counterWidth = Mathf.Min(width * .28f, 2.02f);
|
|
float counterDepth = Mathf.Min(depth * .17f, .66f);
|
|
room.Solid(Joinery, counterX, .462f, counterZ, counterWidth, .924f, counterDepth);
|
|
room.Box(Marble, counterX, .945f, counterZ, counterWidth + .072f, .055f, counterDepth + .087f);
|
|
room.Box(Brass, counterX, .774f, counterZ - counterDepth * .50f, counterWidth, .027f, .029f);
|
|
if (!checkout)
|
|
{
|
|
room.Box(WindowGlass, counterX, 1.118f, counterZ, counterWidth * .91f, .29f, counterDepth * .82f);
|
|
for (int item = -1; item <= 1; item++)
|
|
room.Box(item == 0 ? ShowVelvet : LoungeLeather, counterX + item * counterWidth * .24f,
|
|
1.029f, counterZ, .124f, .095f, .092f);
|
|
room.Guest(GuestActivity.Shopper, counterX, counterZ - counterDepth * .5f - .42f, 31, OnboardService.Retail, .48f);
|
|
return;
|
|
}
|
|
|
|
room.Box(DeckTrim, counterX, 1.027f, counterZ + counterDepth * .29f, .297f, .111f, .193f);
|
|
room.Box(PoolTile, counterX, 1.101f, counterZ + counterDepth * .33f, .246f, .106f, .049f);
|
|
room.Box(LightStrip, counterX, 1.108f, counterZ + counterDepth * .302f, .165f, .049f, .013f);
|
|
room.Guest(GuestActivity.ShopClerk, counterX, counterZ + counterDepth * .5f + .40f, 27,
|
|
OnboardService.Retail, .04f, direction: -1);
|
|
room.Guest(GuestActivity.Shopper, counterX - .11f, counterZ - counterDepth * .5f - .50f, 34, OnboardService.Retail, .39f);
|
|
room.Station(StationKind.Retail, counterX, counterZ - counterDepth * .5f - .10f);
|
|
}
|
|
|
|
private static void FitWellness(Venue room, float width, float depth, bool park)
|
|
{
|
|
float poolZ = depth * .093f;
|
|
var basin = new Vector2(width * (park ? .313f : .253f), depth * .213f);
|
|
float surface = park ? .50f : .44f;
|
|
room.Pool(poolZ, basin, surface + .103f, surface);
|
|
FitPoolSurround(room, poolZ, basin);
|
|
if (park)
|
|
{
|
|
for (int lane = -1; lane <= 1; lane++)
|
|
room.Swimmer(lane * .34f, surface, poolZ + lane * basin.y * .54f, basin.x * .69f,
|
|
74 + lane * 7, .24f + lane * .11f);
|
|
for (int side = -1; side <= 1; side += 2)
|
|
{
|
|
room.Guest(GuestActivity.Wade, side * basin.x * .82f, poolZ + basin.y * .68f,
|
|
89 + side, OnboardService.Amenities, .31f + side * .11f, lift: surface);
|
|
room.Box(SafetyGreen, side * (basin.x + .09f), .617f, poolZ - basin.y * .51f, .13f, .041f, .46f);
|
|
}
|
|
float splashX = basin.x * .79f;
|
|
for (int spray = -1; spray <= 1; spray++)
|
|
{
|
|
float x = splashX + spray * basin.x * .053f;
|
|
float z = poolZ - basin.y * .72f;
|
|
room.Cylinder(Brass, x, surface, z, .091f, .088f);
|
|
Vector3 last = new(x, surface + .081f, z);
|
|
for (int segment = 1; segment <= 8; segment++)
|
|
{
|
|
float t = segment / 8f;
|
|
Vector3 stream = new(x + spray * t * basin.x * .018f,
|
|
surface + Mathf.Lerp(.081f, .014f, t) + Mathf.Sin(t * Mathf.PI) * (.57f + spray * .14f),
|
|
z + t * basin.y * .76f);
|
|
room.Rod(PoolWater, last, stream, .020f);
|
|
last = stream;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (int seat = -1; seat <= 1; seat += 2)
|
|
{
|
|
float x = seat * basin.x * .69f;
|
|
room.Guest(GuestActivity.Wade, x, poolZ, 128 + seat, OnboardService.Amenities, .26f + seat * .09f, lift: surface);
|
|
float sconce = poolZ + basin.y + .32f;
|
|
room.Cylinder(Brass, x, .012f, sconce, .25f, .136f);
|
|
room.Cylinder(LightStrip, x, .262f, sconce, .053f, .102f);
|
|
}
|
|
}
|
|
|
|
// Keep the entrance sightline and cross-ship walkway clear past the basin.
|
|
for (int side = -1; side <= 1; side += 2)
|
|
{
|
|
float x = side * width * .317f;
|
|
float z = -depth * .379f;
|
|
room.Solid(Joinery, x, .228f, z, width * .235f, .444f, .57f);
|
|
room.Box(LoungeLeather, x, .48f, z, width * .238f, .083f, .586f);
|
|
room.Box(Brass, x, .51f, z + .27f, width * .233f, .028f, .039f);
|
|
for (int towel = -1; towel <= 1; towel++)
|
|
room.Box(towel == 0 ? PoolTile : Ivory, x + towel * width * .051f + width * .029f,
|
|
.554f, z, .192f, .093f, .23f);
|
|
room.Guest(GuestActivity.Rest, x - width * .077f, z, 145 + side, OnboardService.Amenities, .45f, .514f);
|
|
}
|
|
room.Station(StationKind.Pool, 0, poolZ - basin.y - .36f);
|
|
}
|
|
|
|
private static void FitPoolSurround(Venue room, float center, Vector2 basin)
|
|
{
|
|
room.Box(PoolDeck, 0, .020f, center, basin.x * 2 + .78f, .029f, basin.y * 2 + .76f);
|
|
for (int side = -1; side <= 1; side += 2)
|
|
{
|
|
float z = center + side * (basin.y + .31f);
|
|
room.Box(Alloy, 0, .037f, z, basin.x * 1.85f, .017f, .081f);
|
|
int slats = Mathf.CeilToInt(basin.x * 8f);
|
|
for (int i = 0; i < slats; i++)
|
|
{
|
|
float x = Mathf.Lerp(-basin.x * .90f, basin.x * .90f, (i + .5f) / slats);
|
|
room.Box(Gasket, x, .046f, z, .023f, .008f, .059f);
|
|
}
|
|
}
|
|
}
|
|
|
|
private readonly struct Venue
|
|
{
|
|
private readonly Geometry shape;
|
|
private readonly Layout layout;
|
|
private readonly Vector3 center;
|
|
private readonly int facing, seed, rotation;
|
|
|
|
public Venue(Geometry shape, Layout layout, Vector3 center, int facing, int seed, int rotation)
|
|
{
|
|
this.shape = shape;
|
|
this.layout = layout;
|
|
this.center = center;
|
|
this.facing = facing;
|
|
this.seed = seed;
|
|
this.rotation = rotation;
|
|
}
|
|
|
|
private Vector3 Point(float x, float y, float z) => center + (rotation switch
|
|
{
|
|
1 => new Vector3(-z * facing, y, x),
|
|
2 => new Vector3(-x, y, -z * facing),
|
|
3 => new Vector3(z * facing, y, -x),
|
|
_ => new Vector3(x, y, z * facing)
|
|
});
|
|
|
|
private Vector3 Size(float width, float height, float depth) =>
|
|
(rotation & 1) == 0 ? new Vector3(width, height, depth) : new Vector3(depth, height, width);
|
|
|
|
public void Station(StationKind kind, float x, float z) =>
|
|
layout.Stations.Add(new ShipStation(kind, Point(x, 1.4f, z)));
|
|
|
|
public void Box(int color, float x, float y, float z, float width, float height, float depth) =>
|
|
shape.Box(color, Point(x, y, z), Size(width, height, depth));
|
|
|
|
public void Solid(int color, float x, float y, float z, float width, float height, float depth)
|
|
{
|
|
var size = Size(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 Rod(int color, Vector3 start, Vector3 end, float radius) =>
|
|
shape.Mesh(color).Rod(Point(start.x, start.y, start.z), Point(end.x, end.y, end.z), radius, 8);
|
|
|
|
public void Seat(float x, float z, int color, int direction = 1)
|
|
{
|
|
Box(color, x, .45f, z, .44f, .089f, .41f);
|
|
Box(color, x, .69f, z - .185f * direction, .43f, .41f, .085f);
|
|
for (int side = -1; side <= 1; side += 2)
|
|
for (int fore = -1; fore <= 1; fore += 2)
|
|
Box(Joinery, x + side * .167f, .208f, z + fore * .158f, .044f, .414f, .044f);
|
|
layout.WalkSpace.Block(Point(x, 0, z), Size(.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) - rotation * 90,
|
|
(int)service, occupancy, seatHeight, program);
|
|
|
|
public void Pool(float z, Vector2 basin, float rim, float surface)
|
|
{
|
|
Vector3 foot = Point(0, 0, z);
|
|
Vector2 worldBasin = (rotation & 1) == 0 ? basin : new Vector2(basin.y, basin.x);
|
|
VesselExterior.PoolBasin(shape.Mesh(Ivory), shape.Mesh(PoolTile), shape.Mesh(PoolWater), foot, worldBasin, rim, surface);
|
|
float ladderX = basin.x * .68f, ladderZ = z + basin.y - .07f;
|
|
var rails = shape.Mesh(Alloy);
|
|
for (int rail = -1; rail <= 1; rail += 2)
|
|
{
|
|
float x = ladderX + rail * .23f;
|
|
Vector3 post = Point(x, .23f, ladderZ + .36f);
|
|
Vector3 elbow = Point(x, .95f, ladderZ + .23f);
|
|
rails.Rod(post, elbow, .028f, 8, true);
|
|
rails.Rod(elbow, Point(x, .54f, ladderZ - .19f), .028f, 8, true);
|
|
}
|
|
for (int rung = 0; rung < 2; rung++)
|
|
{
|
|
float y = .34f + rung * .18f;
|
|
rails.Rod(Point(ladderX - .23f, y, ladderZ - .15f), Point(ladderX + .23f, y, ladderZ - .15f), .024f, 8, true);
|
|
}
|
|
layout.WalkSpace.Block(foot, Size((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 - rotation * 90,
|
|
(int)OnboardService.Amenities, occupancy, swimHalfLength: halfLength);
|
|
}
|
|
}
|
|
}
|