Add MEGA Ocean Liner, split decks, and detailed ship materials

This commit is contained in:
josh
2026-11-28 21:02:42 -05:00
parent ce0d38c8de
commit 46624bf5ba
47 changed files with 2042 additions and 382 deletions

View File

@@ -45,6 +45,7 @@ namespace BigShipTycoon
private float animationTime;
internal VesselExterior.SunDeckLayout SunDeck { get; }
internal VesselExterior.SunDeckLayout AftTerrace { get; }
internal bool HasActiveGuest(GuestActivity activity) => !bridgeView
&& (activeIndex < 0 ? promenade : decks[activeIndex])?.Crowd.activeInHierarchy == true
&& passengerCrowd.HasActiveGuest(activity);
@@ -78,9 +79,13 @@ namespace BigShipTycoon
this.beam = beam;
shader = surface;
SunDeck = VesselExterior.SunDeck(ship);
if (ship.HasAftTerrace)
AftTerrace = VesselExterior.SunDeck(ship, SunDeckZone.AftTerrace);
decks = new Layout[ship.Decks.Count];
Facility programVenue = ship.Count(Facility.GrandTheater) > 0 ? Facility.GrandTheater
Facility programVenue = ship.Count(Facility.OceanArena) > 0 ? Facility.OceanArena
: ship.Count(Facility.GrandTheater) > 0 ? Facility.GrandTheater
: ship.Count(Facility.Entertainment) > 0 ? Facility.Entertainment
: ship.Count(Facility.MarketHall) > 0 ? Facility.MarketHall
: ship.Count(Facility.Restaurant) > 0 ? Facility.Restaurant : Facility.Dining;
for (int index = 0; index < ship.Decks.Count; index++)
{
@@ -102,9 +107,8 @@ namespace BigShipTycoon
if (index < 2)
return (-length * .356f, length * .323f, beam * .77f);
float footprint = VesselExterior.DeckLength(length, index);
float offset = VesselExterior.DeckOffset(length, index);
return (offset - footprint * .43f, offset + footprint * .31f, VesselExterior.DeckHalfBeam(beam, index) * .83f);
var (footprint, width, offset) = MegaDeckGeometry.ForShip(ship, index, ship.Decks.Count);
return (offset - footprint * .43f, offset + footprint * .31f, width * .83f);
}
public Vector3 WalkOrigin(int index)
@@ -115,7 +119,8 @@ namespace BigShipTycoon
}
private float BridgeHeight => VesselExterior.DeckBase + ship.Decks.Count * VesselExterior.DeckSpacing;
private float BridgeHalfWidth => beam * .66f;
private float BridgeHalfWidth => ship.HasAftTerrace
? MegaDeckGeometry.ForShip(ship, ship.Decks.Count - 1, ship.Decks.Count).Beam * .58f : beam * .66f;
private float BridgeAft => BridgeCenter - 4.45f;
private float BridgeFore => BridgeCenter + 4.32f;
@@ -219,12 +224,18 @@ namespace BigShipTycoon
private Layout BuildPromenade()
{
var layout = new Layout("Open promenade", shipRoot);
float y = BridgeHeight + .015f;
VesselExterior.SunDeckLayout plan = SunDeck;
AddOutdoorGuests(layout, SunDeck, BridgeHeight + .015f, false);
if (ship.HasAftTerrace)
AddOutdoorGuests(layout, AftTerrace, BridgeHeight - VesselExterior.DeckSpacing + .015f, true);
return layout;
}
private void AddOutdoorGuests(Layout layout, VesselExterior.SunDeckLayout plan, float y, bool terrace)
{
float width = plan.HalfBeam;
float aft = plan.Offset - plan.Length * .305f;
float fore = Mathf.Min(BridgeCenter - 6.0f, plan.Offset + plan.Length * .17f);
int walkers = 7 + ship.HullIndex * 3;
float fore = terrace ? plan.Offset + plan.Length * .31f : Mathf.Min(BridgeCenter - 6.0f, plan.Offset + plan.Length * .17f);
int walkers = terrace ? 10 : 7 + ship.HullIndex * 3;
for (int side = -1; side <= 1; side += 2)
{
for (int i = 0; i < walkers; i++)
@@ -250,7 +261,6 @@ namespace BigShipTycoon
else
AddSunAttractionGuests(layout, venue, y);
}
return layout;
}
private static void AddSunPoolGuests(Layout layout, VesselExterior.SunDeckLayout plan, float y)
@@ -343,9 +353,9 @@ namespace BigShipTycoon
{
float layerBase = baseLevel + layer * VesselExterior.DeckSpacing;
float layerRoof = layerBase + VesselExterior.DeckSpacing;
float offset = VesselExterior.DeckOffset(length, layer);
var (layerLength, layerBeam, offset) = MegaDeckGeometry.ForShip(ship, layer, ship.Decks.Count);
Vector2 center = new(offset, 0);
outline = Outline(VesselExterior.DeckLength(length, layer) / length, VesselExterior.DeckHalfBeam(beam, layer), offset);
outline = Outline(layerLength / length, layerBeam, offset);
structure.Mesh(Ivory).Loft(outline, center, false, new Vector3(.98f, layerBase, .86f),
new Vector3(.99f, layerBase + .57f, .88f));
structure.Mesh(DeckTrim).Loft(outline, center, false, new Vector3(.99f, layerBase + .57f, .88f),
@@ -355,6 +365,13 @@ namespace BigShipTycoon
structure.Mesh(2).Loft(outline, center, true, new Vector3(1, layerRoof, 1), new Vector3(.998f, layerRoof + .037f, .998f));
}
if (ship.HasAftTerrace)
{
var (deckLength, deckBeam, offset) = MegaDeckGeometry.ForShip(ship, index, ship.Decks.Count);
outline = Outline(deckLength / length, deckBeam, offset);
structure.Mesh(2).Loft(outline, new Vector2(offset, 0), true, new Vector3(.994f, y + .012f, .992f));
}
for (int i = 0; i < outline.Length; i++)
{
Vector2 a = outline[i], b = outline[(i + 1) % outline.Length];
@@ -783,6 +800,17 @@ namespace BigShipTycoon
layout.Stations.Add(new ShipStation(StationKind.Helm, new Vector3(x + .38f, y + 1.40f, 0)));
BridgeConsole(geometry, walk, new Vector3(x + 1.83f, y, -stationOffset), 1.72f, 1);
BridgeConsole(geometry, walk, new Vector3(x + 1.83f, y, stationOffset), 1.72f, 2);
if (ship.HasAftTerrace)
{
for (int side = -1; side <= 1; side += 2)
{
float stationZ = side * extent * .32f;
BridgeConsole(geometry, walk, new Vector3(x + 2.18f, y, stationZ), 2.48f, side > 0 ? 1 : 0);
geometry.Box(Carpet, new Vector3(x + .13f, y + .042f, stationZ), new Vector3(2f, .018f, 2.43f));
geometry.Box(Gasket, new Vector3(x + 2.58f, y + 2.34f, stationZ), new Vector3(.10f, .34f, 2.57f));
PlaceSign(layout.Room.transform, side < 0 ? "ROUTE MONITOR" : "ENGINE CONTROL", new Vector3(x + 2.524f, y + 2.34f, stationZ), 90, .09f);
}
}
BuildHelmWheel(geometry, layout.Room.transform, new Vector3(x + .85f, y + 1.116f, 0));
for (int side = -1; side <= 1; side += 2)
{
@@ -954,7 +982,7 @@ namespace BigShipTycoon
}
}
private float BridgeCenter => VesselExterior.BridgeCenter(length, ship.Decks.Count);
private float BridgeCenter => MegaDeckGeometry.BridgeCenter(ship, 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, float swimHalfLength = 0) =>
@@ -1001,9 +1029,11 @@ namespace BigShipTycoon
0 => Harbor.SurfaceFinish.Hull,
2 or Joinery => Harbor.SurfaceFinish.Timber,
Carpet or BridgeFloor or Upholstery or SuiteCarpet or ShowVelvet or LoungeLeather or PromenadeRunner
or Linen or 11 => Harbor.SurfaceFinish.Fabric,
or Linen or CasinoFelt or 11 => Harbor.SurfaceFinish.Fabric,
Alloy or Brass => Harbor.SurfaceFinish.Alloy,
PoolWater => Harbor.SurfaceFinish.Pool,
Marble => Harbor.SurfaceFinish.Mineral,
Bulkhead or 1 => Harbor.SurfaceFinish.Panel,
_ => Harbor.SurfaceFinish.Paint
};
material.SetFloat("_Finish", (float)surfaceFinish);