using UnityEngine; namespace Soundings { public sealed partial class Harbor { private sealed partial class PortScenery { private void BuildLandmarks() { Vector3 fore = WaterfrontPoint(0, 10); Vector3 town = WaterfrontPoint(0, 48); fore.y = Mathf.Max(fore.y, 1.48f); town.y = Mathf.Max(town.y, 2.6f); switch (port) { case 0: // Miami terminal and the bay skyline. CruiseTerminal(fore, 45, 13, true); Palm(fore + new Vector3(-30, 0, -2.1f), 6.2f, 1.1f); Palm(fore + new Vector3(29, 0, -1.6f), 5.6f, 4.2f); Tower(town + new Vector3(-31, 0, 29), 12, 13, 29, Coat.Trim); Tower(town + new Vector3(8, 0, 36), 15, 12, 38, Coat.WallCool); Tower(town + new Vector3(42, 0, 27), 18, 12, 23, Coat.Wall); break; case 1: // Nassau's pastel wharf and festival amphitheatre. NassauWaterfront(fore); break; case 2: // Key West Customs House above the open Mallory Square wharf. House(town + new Vector3(-9, 0, -18), 19, 13, 11, Coat.Brick); Gable(town + new Vector3(-9, 11.3f, -18), 19.6f, 13.5f, 5.6f, Coat.Brick); House(fore + new Vector3(24, 0, 4), 16, 10, 4.6f, Coat.Wall); Box(Coat.Wood, fore + new Vector3(-20, -.56f, -8), 21, .72f, 14); Palm(fore + new Vector3(4, 0, 9), 5.8f, 1.4f); Palm(fore + new Vector3(12, 0, 6), 5.3f, 2.8f); break; case 3: // Cozumel's narrow finger pier reaches across a shallow reef shelf. FingerPier(fore + new Vector3(-31, 0, -11), 27); House(fore + new Vector3(-16, 0, 6), 21, 9, 4, Coat.WallWarm); House(fore + new Vector3(14, 0, 1), 16, 8, 7, Coat.WallCool); House(fore + new Vector3(37, 0, 7), 18, 11, 5, Coat.Wall); Palm(fore + new Vector3(-3, 0, 4), 6.7f, 2.6f); Palm(fore + new Vector3(26, 0, -2), 5.8f, 0); break; case 4: // El Morro's seaward bastions and round sentry turrets. Fort(fore + new Vector3(-17, 0, 3), 47, 18, 7.4f); Fort(town + new Vector3(-9, 0, -18), 35, 15, 9.3f); Flag(town + new Vector3(-10, 9.7f, -19), 5); break; case 5: // Bermuda Dockyard's long limestone Clocktower building. House(fore + new Vector3(0, 0, 6), 36, 12, 7, Coat.Wall); ClockTower(fore + new Vector3(-14.4f, 0, 4), 4, 16.8f); ClockTower(fore + new Vector3(14.4f, 0, 4), 4, 16.8f); FingerPier(fore + new Vector3(28, 0, -7), 18); break; case 6: // Ponta Delgada's basalt waterfront fort and limewashed frontage. Fort(fore + new Vector3(-23, 0, 3), 29, 19, 4.4f); House(fore + new Vector3(18, 0, 12), 23, 12, 7.2f, Coat.Trim); for (int gate = -1; gate <= 1; gate++) StoneArch(fore + new Vector3(gate * 5.2f + 17, 0, 1.7f), 3.75f, 4.1f, 1.2f, Coat.Rock); break; case 7: // Lisbon's tiled hillside framed by the Pantheon dome. DenseTerraces(town + new Vector3(-49, 0, -13), 8); Box(Coat.Trim, new Vector3(26, town.y + 5.7f, town.z + 8), 17, 11.4f, 14); Dome(new Vector3(26, town.y + 11.4f, town.z + 8), 5.8f, 6.3f, Coat.Trim); break; case 8: // Barcelona's Adossat terminal and the ridge above the old port. CruiseTerminal(fore + new Vector3(-15, 0, 0), 42, 14, false); DenseTerraces(town + new Vector3(5, 0, 0), 6); Box(Coat.Trim, town + new Vector3(28, 16, 38), 25, 4.0f, 14); break; case 9: // Port Said's straight canal wharf and old lighthouse. Lighthouse(fore + new Vector3(16, 0, -1), 3.35f, 20.5f); House(fore + new Vector3(-17, 0, 3), 23, 10, 6.5f, Coat.Wall); ContainerCrane(fore + new Vector3(-40, 0, 1), 17); break; case 10: // Salalah's cargo port below a bare escarpment. for (int crane = -1; crane <= 1; crane++) ContainerCrane(fore + new Vector3(crane * 30, 0, 0), 19 + crane * 2); Containers(fore + new Vector3(-35, 0, 10)); Box(Coat.Trim, town + new Vector3(13, 2.3f, -15), 52, 4.6f, 12); break; case 11: // Mumbai's monumental waterfront arch near the old pier. StoneArch(fore + new Vector3(-9, 0, 4), 10.8f, 13.8f, 7.9f, Coat.WallWarm); for (int side = -1; side <= 1; side += 2) { Vector3 pavilion = fore + new Vector3(-9 + side * 7.1f, 0, 4); Box(Coat.WallWarm, pavilion + Vector3.up * 6.7f, 3.6f, 13.4f, 6.3f); Dome(pavilion + Vector3.up * 13.4f, 1.7f, 1.9f, Coat.Trim); } House(fore + new Vector3(25, 0, 10), 25, 14, 9.4f, Coat.Wall); break; case 12: // Singapore's three bay towers joined by a single elevated deck. for (int tower = -1; tower <= 1; tower++) Tower(town + new Vector3(tower * 14 - 7, 0, 16), 9.5f, 11, 32, Coat.Trim); Box(Coat.Trim, town + new Vector3(-5, 37.3f, 16), 47, 2.5f, 12); Box(Coat.Trim, town + new Vector3(19.7f, 37.2f, 16), 4.1f, 2.3f, 9.5f); CruiseTerminal(fore + new Vector3(12, 0, 0), 34, 10, false); break; case 13: // Benoa's mangrove shoreline and split Balinese gate. Pavilions(fore + new Vector3(-19, 0, 6), 3, 15, 3.0f); for (int side = -1; side <= 1; side += 2) { Vector3 gate = fore + new Vector3(13 + side * 3.2f, 0, 0); for (int tier = 0; tier < 7; tier++) Box(tier % 3 == 0 ? Coat.Brick : Coat.WallWarm, gate + Vector3.up * (tier * 1.1f + .5f), 4.2f - tier * .42f, 1.15f, 4.2f - tier * .37f); } break; case 14: // Sydney's white sail roofs and steel harbour arch. SydneySails(fore + new Vector3(-20, 0, 1)); BridgeArch(town + new Vector3(45, 0, 28), 85, 21, false); break; case 15: // Auckland's long Queens Wharf shed and distant tower. House(fore + new Vector3(-14, 0, 3), 38, 11.5f, 7.3f, Coat.Trim); Gable(fore + new Vector3(-14, 7.64f, 3), 39, 12.2f, 3.4f, Coat.Trim); Needle(town + new Vector3(19, 0, 34)); break; case 16: // Papeete's open waterfront terraces and steep tropical roofs. Pavilions(fore + new Vector3(-30, 0, 5), 4, 17, 5.1f); FingerPier(fore + new Vector3(11, 0, -5), 14); break; case 17: // Honolulu's Aloha Tower against a volcanic ridge. ClockTower(fore + new Vector3(-12, 0, 2), 6.3f, 25.5f); CruiseTerminal(fore + new Vector3(20, 0, 4), 31, 11, false); break; case 18: // San Diego's long pier pavilion and a sweeping bay crossing. CruiseTerminal(fore + new Vector3(-15, 0, 1), 35, 11, false); BridgeArch(town + new Vector3(43, 0, 31), 112, 14, true); break; case 19: // Puerto Vallarta's sheltered marina below the Sierra Madre. FingerPier(fore + new Vector3(-28, 0, -5), 22); DenseTerraces(town + new Vector3(-44, 0, -16), 9); ClockTower(fore + new Vector3(20, 0, 8), 4.1f, 14.3f); break; case 20: // Balboa's canal port and the Bridge of the Americas. BridgeArch(town + new Vector3(12, 0, 57), 127, 30, false); ContainerCrane(fore + new Vector3(-29, 0, 2), 18); ContainerCrane(fore + new Vector3(28, 0, 19), 21); Containers(fore + new Vector3(12, 0, 14)); break; case 21: // Cartagena's low seaside fort and distant high-rise peninsula. Fort(fore + new Vector3(-18, 0, 2), 43, 17, 5.1f); Tower(town + new Vector3(23, 0, 33), 10, 11, 27, Coat.Wall); Tower(town + new Vector3(36, 0, 35), 12, 13, 31, Coat.Trim); Tower(town + new Vector3(49, 0, 42), 9, 10, 21, Coat.WallCool); break; } } private void CruiseTerminal(Vector3 foot, float width, float depth, bool landmarkRoof) { Box(Coat.Trim, foot + Vector3.up * .27f, width * 1.025f, .54f, depth + 1.1f); Box(Coat.WallCool, foot + Vector3.up * 3.35f, width, 6.2f, depth); Box(Coat.Glass, foot + new Vector3(0, 3.3f, -depth * .5f - .045f), width * .92f, 4.6f, .11f); for (int mullion = -11; mullion <= 11; mullion++) { float x = mullion * width * .039f; Box(Coat.Trim, foot + new Vector3(x, 3.3f, -depth * .5f - .115f), .11f, 4.6f, .13f); if (mullion % 5 == 0) Box(Coat.GlassLit, foot + new Vector3(x + width * .015f, 2.46f, -depth * .5f - .12f), width * .020f, 1.2f, .02f); } Box(Coat.Steel, foot + new Vector3(0, 3.9f, -depth * .5f - .11f), width * .92f, .10f, .16f); Box(Coat.Trim, foot + new Vector3(0, 5.84f, -1.01f), width + 1.2f, .23f, depth + 2.6f); if (landmarkRoof) { TerminalRoof(foot + new Vector3(-width * .23f, 6.4f, -.38f), width * .57f, depth + 1.9f, 4.2f, .20f); TerminalRoof(foot + new Vector3(width * .23f, 6.4f, -.38f), width * .54f, depth + 1.9f, 5.6f, -.22f); } else Box(Coat.Roof, foot + new Vector3(0, 6.43f, -.44f), width + 1f, .38f, depth + 1.8f); } private void TerminalRoof(Vector3 foot, float width, float depth, float rise, float lean) { Vector3 left = foot + new Vector3(-width * .5f, 0, -depth * .5f); Vector3 right = foot + new Vector3(width * .5f, 0, -depth * .5f); Vector3 ridge = foot + new Vector3(width * lean, rise, -depth * .5f); Vector3 rear = new(0, -.55f, depth); MeshFor(Coat.Trim).Quad(left, left + rear, ridge + rear, ridge); MeshFor(Coat.Trim).Quad(right + rear, right, ridge, ridge + rear); MeshFor(Coat.Glass).Quad(right, left, ridge, ridge); MeshFor(Coat.Steel).Rod(left, ridge, .11f, 6); MeshFor(Coat.Steel).Rod(ridge, right, .11f, 6); } private void NassauWaterfront(Vector3 foot) { House(foot + new Vector3(-34, 0, 5), 15, 10, 7, Coat.WallWarm); House(foot + new Vector3(-15, 0, 8), 17, 13, 8.7f, Coat.WallCool); House(foot + new Vector3(23, 0, 12), 19, 11, 8, Coat.Trim); House(foot + new Vector3(44, 0, 6), 16, 12, 6.2f, Coat.WallWarm); Vector3 stage = foot + new Vector3(3, 0, 2); MeshFor(Coat.Wood).Disc(stage + Vector3.up * .24f, Vector3.right * 10.2f, Vector3.back * 5.2f, 24); for (int tier = 0; tier < 3; tier++) { float radius = 8.5f + tier * .91f; for (int bay = 0; bay < 12; bay++) { float a = bay * Mathf.PI / 12, b = (bay + 1) * Mathf.PI / 12; Vector3 from = stage + new Vector3(Mathf.Cos(a) * radius, .45f + tier * .40f, Mathf.Sin(a) * radius * .54f); Vector3 to = stage + new Vector3(Mathf.Cos(b) * radius, .45f + tier * .40f, Mathf.Sin(b) * radius * .54f); BoxAlong(Coat.Trim, from, to, .43f, .75f); } } Palm(foot + new Vector3(-25, 0, -2), 6.2f, .1f); Palm(foot + new Vector3(32, 0, 1), 6.4f, 1.1f); } private void FingerPier(Vector3 foot, float length) { Box(Coat.Wood, foot + Vector3.up * .11f, 4.9f, .30f, length); for (int post = -2; post <= 2; post++) for (int side = -1; side <= 1; side += 2) Box(Coat.Wood, foot + new Vector3(side * 2.36f, -.74f, post * length * .205f), .22f, 1.55f, .22f); } private void Fort(Vector3 foot, float width, float depth, float height) { Box(Coat.Sandy, foot + Vector3.up * (height * .44f), width, height * .89f, depth); Box(Coat.Ground, foot + Vector3.up * (height * .91f), width * .89f, .18f, depth * .89f); Box(Coat.Rock, foot + new Vector3(0, height * .94f, -depth * .487f), width, height * .14f, .59f); for (int side = -1; side <= 1; side += 2) { Vector3 turret = foot + new Vector3(side * width * .46f, 0, -depth * .48f); MeshFor(Coat.Sandy).Rod(turret, turret + Vector3.up * (height + 1.2f), 1.66f, 13, true); Dome(turret + Vector3.up * (height + .80f), 1.81f, .72f, Coat.Rock); Box(Coat.Glass, turret + new Vector3(0, height + .09f, -1.68f), .32f, .61f, .14f); } } private void Flag(Vector3 foot, float height) { MeshFor(Coat.Steel).Rod(foot, foot + Vector3.up * height, .055f, 7); MeshFor(Coat.Brick).Quad(foot + Vector3.up * height, foot + new Vector3(2.1f, height - .22f, .19f), foot + new Vector3(2.1f, height - 1.2f, .19f), foot + Vector3.up * (height - .94f)); } private void ClockTower(Vector3 foot, float width, float height) { Box(Coat.Wall, foot + Vector3.up * (height * .43f), width, height * .86f, width); Box(Coat.Trim, foot + Vector3.up * (height * .77f), width * 1.09f, height * .12f, width * 1.09f); Box(Coat.Steel, foot + new Vector3(0, height * .777f, -width * .548f), width * .38f, width * .38f, .14f); MeshFor(Coat.Trim).Disc(foot + new Vector3(0, height * .777f, -width * .564f), Vector3.left * width * .16f, Vector3.up * width * .16f, 16); MeshFor(Coat.Steel).Rod(foot + new Vector3(0, height * .777f, -width * .575f), foot + new Vector3(.26f, height * .777f + .41f, -width * .575f), .037f, 6); Gable(foot + Vector3.up * (height * .86f), width * 1.12f, width * 1.11f, height * .125f, Coat.Trim); } private void StoneArch(Vector3 foot, float opening, float height, float depth, Coat material) { float radius = opening * .5f; float archY = height - radius - 1.3f; float pier = Mathf.Max(1.05f, opening * .20f); for (int side = -1; side <= 1; side += 2) Box(material, foot + new Vector3(side * (radius + pier * .50f), archY * .50f, 0), pier, archY, depth); for (int wedge = 0; wedge < 13; wedge++) { float a = wedge * Mathf.PI / 13, b = (wedge + 1) * Mathf.PI / 13; Vector3 outerA = foot + new Vector3(Mathf.Cos(a) * (radius + pier), archY + Mathf.Sin(a) * (radius + 1.15f), -depth * .5f); Vector3 outerB = foot + new Vector3(Mathf.Cos(b) * (radius + pier), archY + Mathf.Sin(b) * (radius + 1.15f), -depth * .5f); Vector3 innerA = foot + new Vector3(Mathf.Cos(a) * radius, archY + Mathf.Sin(a) * radius, -depth * .5f); Vector3 innerB = foot + new Vector3(Mathf.Cos(b) * radius, archY + Mathf.Sin(b) * radius, -depth * .5f); MeshFor(wedge % 4 == 0 ? Coat.Trim : material).Quad(innerA, innerB, outerB, outerA); MeshFor(material).Quad(innerB, innerA, innerA + Vector3.forward * depth, innerB + Vector3.forward * depth); } Box(Coat.Trim, foot + Vector3.up * (height + .12f), opening + pier * 2.2f, .36f, depth + .18f); } private void DenseTerraces(Vector3 basePoint, int houses) { float setback = Mathf.Max(17, basePoint.z - Shore(basePoint.x)); for (int home = 0; home < houses; home++) { float x = basePoint.x + home * 10f, inland = setback + home % 3 * 8; Vector3 ground = WaterfrontPoint(x, inland); ground.y = Mathf.Max(basePoint.y, ground.y); House(ground, 7.6f, 9.8f, 5.5f + home % 3 * 1.7f, home % 2 == 0 ? Coat.Wall : Coat.WallWarm); } } private void Dome(Vector3 foot, float radius, float height, Coat material) { Vector2[] ring = new Vector2[14]; for (int side = 0; side < ring.Length; side++) { float angle = 2 * Mathf.PI * side / ring.Length; ring[side] = new Vector2(foot.x + Mathf.Cos(angle) * radius, foot.z + Mathf.Sin(angle) * radius); } MeshFor(material).Loft(ring, new Vector2(foot.x, foot.z), true, new Vector3(1, foot.y, 1), new Vector3(.93f, foot.y + height * .43f, .93f), new Vector3(.63f, foot.y + height * .76f, .63f), new Vector3(.23f, foot.y + height * .96f, .23f), new Vector3(.042f, foot.y + height, .042f)); } private void Lighthouse(Vector3 foot, float radius, float height) { foreach (var (low, high, coat) in new[] { (0f, .31f, Coat.Trim), (.31f, .47f, Coat.Steel), (.47f, .66f, Coat.Trim), (.66f, .84f, Coat.Steel), (.84f, .91f, Coat.Trim), (.91f, .98f, Coat.GlassLit) }) MeshFor(coat).Rod(foot + Vector3.up * (low * height), foot + Vector3.up * (high * height), radius * (1 - low * .26f), 8, true); Dome(foot + Vector3.up * (.98f * height), radius * .84f, height * .102f, Coat.Steel); } private void ContainerCrane(Vector3 foot, float height) { float width = height * .44f; for (int side = -1; side <= 1; side += 2) { Vector3 stanchion = foot + Vector3.right * (width * .5f * side); MeshFor(Coat.Accent).Rod(stanchion, stanchion + Vector3.up * height, .21f, 7); } Vector3 peak = foot + Vector3.up * (height * .92f); Box(Coat.Accent, peak, width + .59f, .42f, .55f); MeshFor(Coat.Accent).Rod(peak, peak + new Vector3(width * .46f, height * .12f, -height * .64f), .18f, 7); MeshFor(Coat.Steel).Rod(peak + new Vector3(width * .46f, height * .12f, -height * .64f), peak + new Vector3(width * .46f, -height * .39f, -height * .64f), .037f, 6); } private void Containers(Vector3 foot) { for (int container = 0; container < 9; container++) { Coat paint = container % 3 == 0 ? Coat.Brick : container % 3 == 1 ? Coat.WallCool : Coat.Steel; Vector3 stack = foot + new Vector3(container % 5 * 5.28f, container / 5 * 2.02f + 1, 0); Box(paint, stack, 5.16f, 1.96f, 2.18f); } } private void Pavilions(Vector3 foot, int count, float spacing, float peak) { for (int pavilion = 0; pavilion < count; pavilion++) { Vector3 at = foot + Vector3.right * (spacing * pavilion); for (int side = -1; side <= 1; side += 2) for (int end = -1; end <= 1; end += 2) { Vector3 pillar = at + new Vector3(side * 3.6f, 0, end * 2.55f); MeshFor(Coat.Wood).Rod(pillar, pillar + Vector3.up * 2.8f, .12f, 7); } Gable(at + Vector3.up * 2.8f, 8.8f, 7, peak, Coat.Wood); if (port == 13) Gable(at + Vector3.up * 4.16f, 6.7f, 5.35f, peak * .90f, Coat.Wood); } } private void SydneySails(Vector3 foot) { Box(Coat.Sandy, foot + Vector3.up * .64f, 30, 1.28f, 10); for (int sail = 0; sail < 5; sail++) { Vector3 basePoint = foot + new Vector3(sail * 5.2f - 11.2f, 1.24f, sail % 2 * 1.4f); float rise = 6.3f + 1.65f * (sail % 3); Vector3 left = basePoint + new Vector3(-3.8f, 0, -2.5f), rear = basePoint + new Vector3(-3.8f, 0, 3.1f); for (int segment = 1; segment <= 9; segment++) { float step = segment / 9f; float y = rise * Mathf.Sin(step * 1.57f); float x = Mathf.Lerp(-3.8f, 3.4f, step); Vector3 newLeft = basePoint + new Vector3(x, y, Mathf.Lerp(-2.5f, -.32f, step * step)); Vector3 newRear = basePoint + new Vector3(x, y, Mathf.Lerp(3.1f, .24f, step * step)); MeshFor(Coat.Trim).Quad(left, rear, newRear, newLeft); MeshFor(Coat.Trim).Quad(left, newLeft, newLeft - Vector3.up * y, left - Vector3.up * ((segment - 1) / 9f * rise)); left = newLeft; rear = newRear; } } } private void BridgeArch(Vector3 foot, float span, float rise, bool lowBridge) { float road = lowBridge ? 8f : rise * .32f; Box(Coat.Steel, foot + Vector3.up * road, span + 12, .43f, 3.2f); for (int side = -1; side <= 1; side += 2) { Vector3 prior = foot + new Vector3(-span * .5f, 0, side * 1.45f); for (int section = 1; section <= 16; section++) { float t = section / 16f; float y = 4f * rise * t * (1 - t); var next = foot + new Vector3((t - .5f) * span, y, side * 1.45f); MeshFor(Coat.Steel).Rod(prior, next, .29f, 7); if (section % 2 == 0) MeshFor(Coat.Steel).Rod(next, new Vector3(next.x, foot.y + road, next.z), .088f, 6); prior = next; } Box(Coat.Rock, foot + new Vector3(side * span * .47f, road * .5f, 0), 3.6f, road + .25f, 5.9f); } } private void Needle(Vector3 foot) { MeshFor(Coat.Trim).Rod(foot, foot + Vector3.up * 35f, 1.12f, 10, true); MeshFor(Coat.Glass).Rod(foot + Vector3.up * 31f, foot + Vector3.up * 35.3f, 2.68f, 12, true); Dome(foot + Vector3.up * 35.3f, 2.71f, 1.7f, Coat.Trim); MeshFor(Coat.Steel).Rod(foot + Vector3.up * 36.6f, foot + Vector3.up * 44f, .24f, 8, true); } private void BoxAlong(Coat coat, Vector3 start, Vector3 end, float height, float width) { Vector3 span = end - start; MeshFor(coat).Box((start + end) * .5f, new Vector3(span.magnitude + .05f, height, width), span.normalized); } } } }