Animate passenger venues and add port-specific cinematics
This commit is contained in:
@@ -9,10 +9,11 @@ namespace Soundings
|
||||
private const float EyeHeight = 1.64f;
|
||||
private const float DeckCeiling = 2.44f;
|
||||
private const float AisleWidth = 1.80f;
|
||||
private const float ChairSeatHeight = .515f;
|
||||
private const int Bulkhead = 25, Joinery = 26, Alloy = 27, DeckTrim = 28, Carpet = 29,
|
||||
Ivory = 30, LightStrip = 31, Gasket = 32, DisplayDark = 33, ScreenChart = 34,
|
||||
ScreenGreen = 35, ScreenAmber = 36, BridgeFloor = 37, Upholstery = 38, SafetyGreen = 39,
|
||||
ScreenWater = 40, ScreenLand = 41, ScreenRed = 42, WindowGlass = 43;
|
||||
ScreenWater = 40, ScreenLand = 41, ScreenRed = 42, WindowGlass = 43, PoolWater = 44, PoolTile = 45;
|
||||
private static readonly string[] Paint =
|
||||
{
|
||||
"142C3F", "E1DBCA", "B88754", "8A613C", "283846", "678B93", "B45944", "497975",
|
||||
@@ -20,7 +21,7 @@ namespace Soundings
|
||||
"573B2E", "A46C50", "DFAB86", "40577D", "BF7756", "D3B973", "76ADA8", "A684AB", "E3DED0",
|
||||
"B7BFC0", "AD825C", "91A9AF", "284550", "385361", "DCE1DB", "FFF1D7", "202D36",
|
||||
"111D25", "8ED9E0", "65C89B", "E7B868", "3F565C", "416172", "527D65", "29485A", "A8AB71",
|
||||
"D66D57", "80B6C5"
|
||||
"D66D57", "80B6C5", "3796A3", "47878F"
|
||||
};
|
||||
|
||||
private readonly Transform shipRoot;
|
||||
@@ -40,6 +41,10 @@ namespace Soundings
|
||||
private bool bridgeView;
|
||||
private float animationTime;
|
||||
|
||||
internal bool HasActiveGuest(GuestActivity activity) => !bridgeView
|
||||
&& (activeIndex < 0 ? promenade : decks[activeIndex])?.Crowd.activeInHierarchy == true
|
||||
&& passengerCrowd.HasActiveGuest(activity);
|
||||
|
||||
private sealed class Layout
|
||||
{
|
||||
public readonly GameObject Room, Crowd, Interior, Cutaway;
|
||||
@@ -175,12 +180,20 @@ namespace Soundings
|
||||
|
||||
public void HidePassengers()
|
||||
{
|
||||
promenade.Crowd.SetActive(false);
|
||||
HideCrowd(promenade);
|
||||
foreach (Layout deck in decks)
|
||||
deck?.Crowd.SetActive(false);
|
||||
if (deck != null)
|
||||
HideCrowd(deck);
|
||||
}
|
||||
|
||||
public void Tick(OnboardSession session, float delta)
|
||||
private static void HideCrowd(Layout layout)
|
||||
{
|
||||
layout.Crowd.SetActive(false);
|
||||
foreach (DeckGuest guest in layout.People)
|
||||
guest.Initialized = false;
|
||||
}
|
||||
|
||||
public void Tick(OnboardSession session, float delta, Camera view)
|
||||
{
|
||||
if (session == null)
|
||||
return;
|
||||
@@ -191,7 +204,7 @@ namespace Soundings
|
||||
if (!layout.Crowd.activeSelf)
|
||||
layout.Crowd.SetActive(true);
|
||||
layout.CrowdMesh ??= passengerCrowd.CreateMesh(layout.Crowd, length, beam);
|
||||
passengerCrowd.Draw(layout.CrowdMesh, layout.People, session, activeIndex < 0, animationTime, delta);
|
||||
passengerCrowd.Draw(layout.CrowdMesh, layout.People, session, activeIndex < 0, animationTime, delta, view);
|
||||
}
|
||||
|
||||
private Layout BuildPromenade()
|
||||
@@ -204,14 +217,17 @@ namespace Soundings
|
||||
float offset = VesselExterior.DeckOffset(length, deck);
|
||||
float aft = offset - deckLength * .305f;
|
||||
float fore = Mathf.Min(BridgeCenter - 6.0f, offset + deckLength * .17f);
|
||||
float pool = VesselExterior.SunDeckCenter(length, deck);
|
||||
bool hasPool = ship.Count(Facility.Amenity) > 0;
|
||||
int sunDeckService = hasPool ? (int)OnboardService.Amenities : -1;
|
||||
int walkers = 7 + ship.HullIndex * 3;
|
||||
for (int side = -1; side <= 1; side += 2)
|
||||
{
|
||||
for (int i = 0; i < walkers; i++)
|
||||
{
|
||||
float occupancy = Mathf.Lerp(.15f, .95f, i / (float)(walkers - 1));
|
||||
var route = new Vector3(aft, y, side * width * .865f);
|
||||
layout.People.Add(new DeckGuest(route, fore, width * .075f, (i + (side > 0 ? .43f : 0)) / walkers,
|
||||
var route = new Vector3(aft, y, side * width * .895f);
|
||||
layout.People.Add(new DeckGuest(route, fore, .285f, (i + (side > 0 ? .43f : 0)) / walkers,
|
||||
15 + i * 13 + (side > 0 ? 131 : 0), occupancy));
|
||||
}
|
||||
|
||||
@@ -219,13 +235,30 @@ namespace Soundings
|
||||
float heading = side < 0 ? 180 : 0;
|
||||
AddGuest(layout, GuestActivity.Rail, new Vector3(fore + .92f, y, side * rail), 78 + side, heading, -1, .28f);
|
||||
AddGuest(layout, GuestActivity.Photograph, new Vector3(aft - .98f, y, side * (rail - .16f)), 32 + side, heading, -1, .57f);
|
||||
|
||||
float seatZ = side * (width * VesselExterior.LoungerBeamFraction + .105f);
|
||||
for (int chair = 0; chair < 3; chair++)
|
||||
{
|
||||
float x = VesselExterior.LoungerX(pool, chair * 3 + (side > 0 ? 1 : 0));
|
||||
AddGuest(layout, GuestActivity.Lounge, new Vector3(x, y, seatZ), 96 + chair * 7 + side * 4,
|
||||
heading + 180, sunDeckService, .19f + chair * .20f, VesselExterior.LoungerSeatHeight + .065f);
|
||||
}
|
||||
}
|
||||
|
||||
float pool = offset + deckLength * .01f;
|
||||
AddGuest(layout, GuestActivity.Talk, new Vector3(pool - 3.40f, y, -1.14f), 37, 0, (int)OnboardService.Amenities, .20f);
|
||||
AddGuest(layout, GuestActivity.Talk, new Vector3(pool - 3.62f, y, -.20f), 214, 167, (int)OnboardService.Amenities, .44f);
|
||||
AddGuest(layout, GuestActivity.Rest, new Vector3(pool + 1.77f, y, width * .67f + .07f), 35, 180, (int)OnboardService.Amenities, .23f, .26f);
|
||||
AddGuest(layout, GuestActivity.Photograph, new Vector3(pool + .9f, y, -2.32f), 62, 180, (int)OnboardService.Amenities, .64f);
|
||||
AddGuest(layout, GuestActivity.Talk, new Vector3(pool - 3.57f, y, -.61f), 37, 22, sunDeckService, .28f);
|
||||
AddGuest(layout, GuestActivity.Talk, new Vector3(pool - 3.21f, y, .26f), 214, 202, sunDeckService, .44f);
|
||||
if (hasPool)
|
||||
{
|
||||
float waterY = BridgeHeight + VesselExterior.PoolWaterHeight;
|
||||
AddGuest(layout, GuestActivity.Swim, new Vector3(pool, waterY, -.67f), 440, 90, sunDeckService, .20f,
|
||||
swimHalfLength: 1.50f);
|
||||
AddGuest(layout, GuestActivity.Swim, new Vector3(pool - .32f, waterY, .25f), 587, -90, sunDeckService, .53f,
|
||||
swimHalfLength: 1.18f);
|
||||
AddGuest(layout, GuestActivity.Wade, new Vector3(pool + 1.72f, waterY, .79f), 768, -96, sunDeckService, .33f);
|
||||
AddGuest(layout, GuestActivity.Wade, new Vector3(pool + 1.00f, waterY, .91f), 921, 82, sunDeckService, .67f);
|
||||
AddGuest(layout, GuestActivity.Photograph, new Vector3(pool + 2.92f, y, -1.95f), 62, -53,
|
||||
sunDeckService, .64f);
|
||||
}
|
||||
return layout;
|
||||
}
|
||||
|
||||
@@ -530,34 +563,48 @@ namespace Soundings
|
||||
}
|
||||
Seat(x, -.58f, Upholstery);
|
||||
Seat(x, .81f, Upholstery, -1);
|
||||
Guest(GuestActivity.Dine, x, -.61f, side + 1, OnboardService.Meals, side < 0 ? .21f : .56f, .54f);
|
||||
Guest(GuestActivity.Dine, x, .84f, side + 4, OnboardService.Meals, side < 0 ? .75f : .93f, .54f, -1);
|
||||
Guest(GuestActivity.Dine, x, -.61f, side + 1, OnboardService.Meals, side < 0 ? .21f : .56f, ChairSeatHeight);
|
||||
Guest(GuestActivity.Dine, x, .84f, side + 4, OnboardService.Meals, side < 0 ? .75f : .93f, ChairSeatHeight, -1);
|
||||
}
|
||||
if (programVenue)
|
||||
Guest(GuestActivity.Guitar, 0, .32f, 32, OnboardService.Shows, .22f, direction: -1,
|
||||
program: EntertainmentProgram.LiveMusic);
|
||||
break;
|
||||
case Facility.Bar:
|
||||
Solid(Joinery, 0, .48f, depth * .18f, width * .77f, .94f, .81f);
|
||||
Box(Gasket, 0, .974f, depth * .18f, width * .79f, .10f, .92f);
|
||||
Box(8, 0, .20f, depth * .18f - .44f, width * .74f, .050f, .045f);
|
||||
Box(LightStrip, 0, .867f, depth * .18f - .422f, width * .74f, .031f, .043f);
|
||||
float counter = depth * .025f;
|
||||
Solid(Joinery, 0, .48f, counter, width * .76f, .94f, .65f);
|
||||
Box(Gasket, 0, .974f, counter, width * .79f, .10f, .75f);
|
||||
Box(8, 0, .20f, counter - .378f, width * .74f, .050f, .045f);
|
||||
Box(LightStrip, 0, .867f, counter - .35f, width * .74f, .031f, .043f);
|
||||
float display = depth * .44f;
|
||||
Box(DeckTrim, 0, 1.50f, display + .09f, width * .67f, .68f, .10f);
|
||||
Box(Joinery, 0, 1.36f, display, width * .69f, .053f, .22f);
|
||||
Box(LightStrip, 0, 1.80f, display + .047f, width * .66f, .045f, .09f);
|
||||
for (int bottle = -8; bottle <= 8; bottle++)
|
||||
{
|
||||
float x = bottle * width * .035f;
|
||||
int color = Mathf.Abs(bottle) % 3 == 1 ? SafetyGreen : Mathf.Abs(bottle) % 3 == 2 ? 13 : 12;
|
||||
float height = .16f + (Mathf.Abs(bottle) % 4) * .022f;
|
||||
Box(color, x, 1.393f + height * .5f, display - .024f, .067f, height, .063f);
|
||||
Box(Alloy, x, 1.382f + height, display - .024f, .039f, .048f, .040f);
|
||||
}
|
||||
for (int i = -2; i <= 2; i++)
|
||||
{
|
||||
float x = i * width * .115f;
|
||||
Box(i % 2 == 0 ? SafetyGreen : 13, x + .12f, 1.117f, depth * .19f, .07f, .18f, .071f);
|
||||
Box(Alloy, x + .12f, 1.224f, depth * .19f, .055f, .06f, .044f);
|
||||
if (i != 0)
|
||||
{
|
||||
float stool = depth * .18f - .97f;
|
||||
Box(Alloy, x, .057f, stool, .39f, .11f, .39f);
|
||||
Box(Alloy, x, .35f, stool, .077f, .69f, .077f);
|
||||
Box(Upholstery, x, .69f, stool, .38f, .10f, .39f);
|
||||
Box(Alloy, x, .26f, stool, .30f, .035f, .23f);
|
||||
layout.WalkSpace.Block(pos + new Vector3(x, 0, stool * facing), new Vector3(.39f, .76f, .40f));
|
||||
Guest(GuestActivity.Drink, x, stool, i + 4, OnboardService.Drinks, i is 1 or -1 ? .35f : .73f, .80f);
|
||||
}
|
||||
if (i == 0)
|
||||
continue;
|
||||
float stool = counter - .83f;
|
||||
Box(Alloy, x, .057f, stool, .39f, .11f, .39f);
|
||||
Box(Alloy, x, .35f, stool, .077f, .69f, .077f);
|
||||
Box(Upholstery, x, .69f, stool, .38f, .10f, .39f);
|
||||
Box(Alloy, x, .26f, stool + .035f, .30f, .035f, .25f);
|
||||
Box(8, x, 1.028f, counter - .223f, .154f, .008f, .154f);
|
||||
layout.WalkSpace.Block(pos + new Vector3(x, 0, stool * facing), new Vector3(.39f, .76f, .40f));
|
||||
Guest(GuestActivity.Drink, x, stool, i + 4, OnboardService.Drinks, i is 1 or -1 ? .25f : .76f, .775f);
|
||||
}
|
||||
Box(SafetyGreen, width * .14f, 1.116f, counter + .13f, .07f, .18f, .071f);
|
||||
Box(Alloy, width * .14f, 1.224f, counter + .13f, .055f, .06f, .044f);
|
||||
Guest(GuestActivity.TendBar, 0, counter + .72f, 11, OnboardService.Drinks, .08f, direction: -1);
|
||||
break;
|
||||
case Facility.Entertainment:
|
||||
Solid(Gasket, 0, .19f, depth * .307f, width * .82f, .38f, .99f);
|
||||
@@ -573,7 +620,7 @@ namespace Soundings
|
||||
float z = -.37f + row * .62f;
|
||||
Seat(x, z, 10);
|
||||
Guest(GuestActivity.Watch, x, z, 46 + i + row * 5, OnboardService.Shows,
|
||||
row == 0 ? .29f + Mathf.Abs(i) * .13f : .59f + Mathf.Abs(i) * .13f, .54f);
|
||||
row == 0 ? .29f + Mathf.Abs(i) * .13f : .59f + Mathf.Abs(i) * .13f, ChairSeatHeight);
|
||||
}
|
||||
Guest(GuestActivity.Perform, 0, depth * .31f, 30, OnboardService.Shows, .06f, direction: -1, lift: .42f);
|
||||
if (programVenue)
|
||||
@@ -587,16 +634,26 @@ namespace Soundings
|
||||
}
|
||||
break;
|
||||
case Facility.Amenity:
|
||||
Solid(Ivory, 0, .18f, depth * .18f, width * .65f, .33f, depth * .44f);
|
||||
Box(ScreenChart, 0, .356f, depth * .18f, width * .57f, .023f, depth * .36f);
|
||||
for (int i = -4; i <= 4; i++)
|
||||
Box(15, i * width * .062f, .370f, depth * .18f, .021f, .004f, depth * .34f);
|
||||
Vector2 basin = new(Mathf.Min(2.58f, width * .295f), depth * .24f);
|
||||
const float poolLevel = .44f;
|
||||
float poolZ = depth * .13f;
|
||||
Vector3 poolFoot = pos + Vector3.forward * (poolZ * facing);
|
||||
VesselExterior.PoolBasin(shape.Mesh(Ivory), shape.Mesh(PoolTile), shape.Mesh(PoolWater), poolFoot, basin, .56f, poolLevel);
|
||||
VesselExterior.PoolRails(shape.Mesh(Alloy), poolFoot + new Vector3(-basin.x * .69f, .18f, -basin.y * facing), -facing);
|
||||
layout.WalkSpace.Block(poolFoot, new Vector3((basin.x + .23f) * 2f, .56f, (basin.y + .23f) * 2f));
|
||||
Guest(GuestActivity.Wade, basin.x * .37f, poolZ - basin.y * .12f, 7, OnboardService.Amenities, .12f,
|
||||
lift: poolLevel);
|
||||
Guest(GuestActivity.Wade, -basin.x * .25f, poolZ + basin.y * .24f, 51, OnboardService.Amenities, .57f,
|
||||
direction: -1, lift: poolLevel);
|
||||
for (int side = -1; side <= 1; side += 2)
|
||||
{
|
||||
Solid(Joinery, side * width * .308f, .25f, -depth * .25f, 1.41f, .34f, .53f);
|
||||
Box(Ivory, side * width * .308f, .451f, -depth * .25f, 1.35f, .105f, .49f);
|
||||
Guest(side > 0 ? GuestActivity.Read : GuestActivity.Rest, side * width * .308f, -depth * .25f,
|
||||
side + 3, OnboardService.Amenities, side < 0 ? .30f : .75f, .60f);
|
||||
float seatX = side * width * .401f;
|
||||
float bench = -depth * .36f;
|
||||
Solid(Joinery, seatX, .20f, bench, .94f, .36f, .46f);
|
||||
Box(Upholstery, seatX, .418f, bench, .92f, .089f, .46f);
|
||||
Box(Upholstery, seatX, .61f, bench - .211f, .93f, .36f, .072f);
|
||||
Guest(side > 0 ? GuestActivity.Read : GuestActivity.Rest, seatX, bench,
|
||||
side + 3, OnboardService.Amenities, side < 0 ? .30f : .75f, .483f);
|
||||
}
|
||||
break;
|
||||
case Facility.Tank:
|
||||
@@ -906,8 +963,8 @@ namespace Soundings
|
||||
private float BridgeCenter => VesselExterior.BridgeCenter(length, ship.Decks.Count);
|
||||
|
||||
private static void AddGuest(Layout layout, GuestActivity activity, Vector3 station, int seed, float heading,
|
||||
int service, float occupancy, float seatHeight = 0, EntertainmentProgram? program = null) =>
|
||||
layout.People.Add(new DeckGuest(activity, station, seed, heading, service, occupancy, seatHeight, program));
|
||||
int service, float occupancy, float seatHeight = 0, EntertainmentProgram? program = null, float swimHalfLength = 0) =>
|
||||
layout.People.Add(new DeckGuest(activity, station, seed, heading, service, occupancy, seatHeight, program, swimHalfLength));
|
||||
|
||||
private static void Chair(Geometry shape, Vector3 at, int color, int side)
|
||||
{
|
||||
@@ -951,12 +1008,13 @@ namespace Soundings
|
||||
2 or Joinery => Harbor.SurfaceFinish.Timber,
|
||||
Carpet or BridgeFloor or Upholstery or 11 => Harbor.SurfaceFinish.Fabric,
|
||||
Alloy => Harbor.SurfaceFinish.Alloy,
|
||||
PoolWater => Harbor.SurfaceFinish.Pool,
|
||||
_ => Harbor.SurfaceFinish.Paint
|
||||
};
|
||||
material.SetFloat("_Finish", (float)surfaceFinish);
|
||||
if (id == 0)
|
||||
material.SetFloat("_Waterline", 1);
|
||||
material.SetFloat("_Roughness", metal ? .39f : .76f);
|
||||
material.SetFloat("_Roughness", id == PoolWater ? .16f : metal ? .39f : .76f);
|
||||
material.SetFloat("_Metal", metal ? .45f : .04f);
|
||||
material.SetFloat("_Weather", id is Carpet or BridgeFloor or Upholstery ? .57f : .12f);
|
||||
material.SetFloat("_Emissive", id switch
|
||||
|
||||
Reference in New Issue
Block a user