92 lines
4.9 KiB
C#
92 lines
4.9 KiB
C#
using UnityEngine;
|
|
|
|
namespace Soundings
|
|
{
|
|
internal sealed partial class VesselExterior
|
|
{
|
|
private void BuildHullFittings(int side)
|
|
{
|
|
// The bow marks are painted on the changing cross-section just above the waterline.
|
|
for (int mark = 0; mark < 6; mark++)
|
|
{
|
|
float y = .51f + mark * .247f;
|
|
var (at, along, outward) = SideFrame(.895f, y, length * 1.001f,
|
|
beam * Mathf.Lerp(.977f, 1f, mark / 5f), 0, side, HullStations);
|
|
at += outward * .038f;
|
|
SidePanel(Coat(Paint.Pearl), at, along, side, mark % 3 == 0 ? .32f : .18f, .046f);
|
|
if (mark % 3 == 0)
|
|
SidePanel(Coat(Paint.Pearl), at + Vector3.up * .047f - along * .136f, along, side, .047f, .116f);
|
|
}
|
|
|
|
for (int position = 0; position < 2; position++)
|
|
{
|
|
float station = position == 0 ? .113f : .835f;
|
|
var (at, along, outward) = SideFrame(station, 4.52f, length * 1.010f, beam * 1.029f,
|
|
0, side, HullStations);
|
|
Coat(Paint.Steel).Disc(at + outward * .046f, along * (side * .47f), Vector3.up * .21f, 12);
|
|
Coat(Paint.Black).Disc(at + outward * .054f, along * (side * .367f), Vector3.up * .136f, 12);
|
|
Coat(Paint.Steel).Rod(at + outward * .062f + along * .085f - Vector3.up * .121f,
|
|
at + outward * .062f + along * .085f + Vector3.up * .120f, .042f, 8, true);
|
|
}
|
|
|
|
// Frames and a cabling run break up the flush embarkation hatch.
|
|
var (door, hinge, face) = SideFrame(.56f, 3.22f, length * 1.004f, beam * 1.016f, 0, side, HullStations);
|
|
Vector3 center = door + face * .046f;
|
|
SidePanel(Coat(Paint.Steel), center + Vector3.up * .718f, hinge, side, 2.08f, .034f);
|
|
SidePanel(Coat(Paint.Steel), center - Vector3.up * .724f, hinge, side, 2.08f, .034f);
|
|
for (int edge = -1; edge <= 1; edge += 2)
|
|
{
|
|
Vector3 jamb = center + hinge * (edge * 1.032f);
|
|
SidePanel(Coat(Paint.Steel), jamb, hinge, side, .035f, 1.44f);
|
|
SidePanel(Coat(Paint.Gold), jamb + hinge * (edge * .15f) + Vector3.up * .55f, hinge, side, .106f, .17f);
|
|
}
|
|
}
|
|
|
|
private void BuildPoolDeckFittings(SunDeckLayout plan, float floor)
|
|
{
|
|
for (int side = -1; side <= 1; side += 2)
|
|
{
|
|
float drainZ = side * (plan.PoolHalfSize.y + .36f);
|
|
float strip = plan.PoolHalfSize.x * 1.92f;
|
|
var center = new Vector3(plan.PoolCenter, floor, drainZ);
|
|
Coat(Paint.Steel).Box(center + Vector3.up * .017f, new Vector3(strip, .033f, .116f));
|
|
Coat(Paint.Black).Box(center + Vector3.up * .031f, new Vector3(strip - .033f, .014f, .072f));
|
|
int slats = Mathf.CeilToInt(strip / .16f);
|
|
for (int i = 0; i < slats; i++)
|
|
{
|
|
float x = (i + .5f) * strip / slats - strip * .5f;
|
|
Coat(Paint.Steel).Box(center + new Vector3(x, .045f, 0), new Vector3(.027f, .017f, .091f));
|
|
}
|
|
|
|
// Fit the storage against the pool end and out of the walking lane along the rail.
|
|
float cabinetZ = side * plan.HalfBeam * .48f;
|
|
var basePoint = new Vector3(plan.PoolCenter - plan.PoolHalfSize.x - 1.42f, floor, cabinetZ);
|
|
Coat(Paint.Navy).Box(basePoint + Vector3.up * .48f, new Vector3(.95f, .96f, .55f));
|
|
Coat(Paint.Teak).Box(basePoint + Vector3.up * .978f, new Vector3(1.04f, .054f, .61f));
|
|
Coat(Paint.Steel).Box(basePoint + new Vector3(0, .45f, side * .284f), new Vector3(.31f, .032f, .036f));
|
|
for (int towel = 0; towel < 3; towel++)
|
|
{
|
|
Vector3 end = basePoint + new Vector3(towel * .239f - .238f, 1.053f, -.14f);
|
|
Coat(towel == 1 ? Paint.DeckCanvas : Paint.Pearl).Rod(end, end + Vector3.forward * .29f, .062f, 10, true);
|
|
}
|
|
var buoy = basePoint + new Vector3(.604f, 1.15f, 0);
|
|
Coat(Paint.Steel).Rod(buoy - Vector3.up * 1.15f, buoy + Vector3.up * .21f, .035f, 8, true);
|
|
BuildLifebuoy(buoy, .214f);
|
|
}
|
|
}
|
|
|
|
private void BuildLifebuoy(Vector3 center, float radius)
|
|
{
|
|
const int segments = 16;
|
|
for (int i = 0; i < segments; i++)
|
|
{
|
|
float angle = i * Mathf.PI * 2 / segments;
|
|
float next = (i + 1) * Mathf.PI * 2 / segments;
|
|
Vector3 a = center + new Vector3(Mathf.Cos(angle), Mathf.Sin(angle), 0) * radius;
|
|
Vector3 b = center + new Vector3(Mathf.Cos(next), Mathf.Sin(next), 0) * radius;
|
|
Coat(i % 4 == 0 ? Paint.Pearl : Paint.Lifeboat).Rod(a, b, .053f, 8);
|
|
}
|
|
}
|
|
}
|
|
}
|