Add manual helm, grounded interiors, and taller ship classes

This commit is contained in:
josh
2026-11-27 22:44:09 -05:00
parent 33cdd6dfa7
commit 7951e1c878
29 changed files with 1745 additions and 429 deletions

View File

@@ -6,39 +6,56 @@ namespace Soundings
internal sealed class ServiceDeckModel
{
public static readonly string[] Areas = { "Engine room", "Galley", "Stores", "Maintenance", "Water plant", "Sewage treatment" };
private static readonly string[] StationLabels = { "MACHINERY CONTROL", "MAIN GALLEY", "PROVISION STORES", "TECHNICAL WORKSHOP", "FRESH WATER", "WASTEWATER TREATMENT" };
private const int Wall = 0xB9C1BB, WallBase = 0x718589, Rib = 0x596F75, Floor = 0x344A50,
RoomFloor = 0x505B56, Grating = 0x87989A, Ceiling = 0x869692, Dark = 0x243539,
White = 0xE0DED0, Steel = 0x9AAEB0, SteelDark = 0x526C70, Rubber = 0x263738,
FixtureLight = 0xFFE7BA, EmergencyLight = 0xB9F6D1, Warning = 0xDCAF58,
Red = 0xA64C3E, Motor = 0x547469, Water = 0x397D95, Waste = 0x5C7966,
Amber = 0xE7AA49, Monitor = 0x79B7B6;
private const float CorridorHalfWidth = 1.45f, CeilingHeight = 3.1f;
private readonly Dictionary<int, HarborMesh> batches = new Dictionary<int, HarborMesh>();
private readonly List<Mesh> meshes = new List<Mesh>();
private readonly List<Material> materials = new List<Material>();
private readonly float span, width;
private readonly float span, halfWidth, bayLength, doorway;
private readonly Font font;
public GameObject Root { get; }
internal ShipWalkSpace WalkSpace { get; }
public ServiceDeckModel(Transform parent, float length, float beam, Shader surface)
public ServiceDeckModel(Transform parent, float length, float beam, Shader fallbackSurface)
{
span = length * .68f;
width = beam * 1.75f;
halfWidth = Mathf.Clamp(beam * .72f, 4.75f, 7.1f);
bayLength = span / Areas.Length;
doorway = Mathf.Min(3.15f, bayLength * .56f);
WalkSpace = new ShipWalkSpace(-span * .5f, span * .5f, -halfWidth, halfWidth);
Root = new GameObject("Service deck");
Root.layer = 8;
Root.transform.SetParent(parent, false);
BuildEnvelope();
font = Resources.Load<Font>("Interface");
BuildPassage();
for (int area = 0; area < Areas.Length; area++)
{
float x = AreaCenter(area);
int accent = area switch { 0 => 0xB88E58, 1 => 0xB77661, 2 => 0x9DA775, 3 => 0xCEAC61, 4 => 0x65B3C7, _ => 0x73AB82 };
Box(accent, x, .022f, .82f, span / Areas.Length - .35f, .03f, .14f);
Box(0x263744, x, 2.72f, width * .5f - .15f, 4.7f, .64f, .16f);
Sign(Areas[area].ToUpperInvariant(), x, 2.72f, width * .5f - .26f, new Color32(235, 224, 193, 255));
BuildArea(area, x, accent);
}
BuildBay(area, AreaCenter(area));
Shader surface = Resources.Load<Shader>("ServiceSurface");
foreach (var pair in batches)
{
var game = new GameObject("Service deck finish", typeof(MeshFilter), typeof(MeshRenderer));
game.layer = 8;
game.transform.SetParent(Root.transform, false);
Mesh mesh = pair.Value.Bake();
var material = new Material(surface) { color = ColorOf(pair.Key) };
material.SetFloat("_Roughness", .56f);
material.SetFloat("_Emissive", pair.Key == 0xFFF1C8 ? 1 : .21f);
var material = new Material(surface != null ? surface : fallbackSurface) { color = ColorOf(pair.Key) };
bool steel = pair.Key is Steel or SteelDark or Grating;
float emission = pair.Key switch { FixtureLight => .85f, EmergencyLight => .60f, Monitor => .34f, Amber => .18f, _ => 0 };
material.SetFloat("_Roughness", steel ? .30f : .68f);
material.SetFloat("_Metal", steel ? .62f : .025f);
material.SetFloat("_Emissive", emission);
if (surface != null)
{
material.SetFloat("_BayLength", bayLength);
material.SetFloat("_RoomLight", Mathf.Lerp(CorridorHalfWidth, halfWidth, .55f));
material.SetFloat("_DeckTread", pair.Key is Floor or RoomFloor or Grating ? 1 : 0);
}
game.GetComponent<MeshFilter>().sharedMesh = mesh;
game.GetComponent<MeshRenderer>().sharedMaterial = material;
meshes.Add(mesh);
@@ -48,132 +65,274 @@ namespace Soundings
Root.SetActive(false);
}
public Vector3 Entry(int area) => new Vector3(AreaCenter(area), 1.65f, -.75f);
public Vector3 Entry(int area) => new Vector3(AreaCenter(area), 1.65f, -.90f);
public float Heading(int area) => 0;
private float AreaCenter(int area) => -span * .5f + span * (Mathf.Clamp(area, 0, Areas.Length - 1) + .5f) / Areas.Length;
private float AreaCenter(int area) => -span * .5f + bayLength * (Mathf.Clamp(area, 0, Areas.Length - 1) + .5f);
private void BuildEnvelope()
private void BuildPassage()
{
Box(0x596666, 0, -.13f, 0, span, .24f, width);
Box(0x626B6D, 0, 3.31f, 0, span, .22f, width);
Box(RoomFloor, 0, -.10f, 0, span, .18f, halfWidth * 2);
Box(Floor, 0, -.025f, 0, span - .035f, .054f, CorridorHalfWidth * 2);
Box(Ceiling, 0, CeilingHeight + .07f, 0, span, .14f, halfWidth * 2);
for (int side = -1; side <= 1; side += 2)
{
Box(0x81918C, 0, 1.63f, side * width * .5f, span, 3.35f, .2f);
Box(0x37454D, 0, .32f, side * (width * .5f - .13f), span, .65f, .13f);
Box(0xB8AD82, 0, .018f, side * 1.12f, span - .20f, .024f, .06f);
Box(0x9F6E48, side * span * .5f, 1.62f, 0, .22f, 3.35f, width);
Pipe(0x638FAA, new Vector3(-span * .49f, 2.87f, side * (width * .5f - .43f)),
new Vector3(span * .49f, 2.87f, side * (width * .5f - .43f)), .12f);
Box(Wall, 0, CeilingHeight * .5f, side * halfWidth, span, CeilingHeight, .14f, true);
Box(WallBase, 0, .32f, side * (halfWidth - .078f), span, .62f, .025f);
Box(Wall, side * span * .5f, CeilingHeight * .5f, 0, .18f, CeilingHeight, halfWidth * 2, true);
Box(WallBase, side * (span * .5f - .10f), .30f, 0, .04f, .58f, halfWidth * 2);
Box(WallBase, 0, .003f, side * 1.06f, span - .32f, .012f, .060f);
Pipe(Water, new Vector3(-span * .495f, 2.85f, side * .97f), new Vector3(span * .495f, 2.85f, side * .97f), .060f, 12);
Pipe(0xB88F57, new Vector3(-span * .495f, 2.85f, side * 1.18f), new Vector3(span * .495f, 2.85f, side * 1.18f), .045f, 12);
Box(SteelDark, 0, 2.94f, side * 1.37f, span - .16f, .19f, .19f);
Box(WallBase, 0, 2.92f, side * (halfWidth - .30f), span - .22f, .16f, .38f);
Box(EmergencyLight, side * (span * .5f - .104f), 2.36f, 0, .03f, .17f, .61f);
}
for (int i = 0; i <= 12; i++)
for (int rib = 0; rib <= Areas.Length * 2; rib++)
{
float x = span * (i / 12f - .5f);
Box(0x42545A, x, .002f, 0, .043f, .026f, width);
Box(0x52636B, x, 3.13f, 0, .24f, .14f, width);
Box(0xFFF1C8, x, 3.04f, -.20f, .57f, .038f, 1.05f);
}
for (int i = 1; i < Areas.Length; i++)
{
float x = span * (i / (float)Areas.Length - .5f);
Box(0x778580, x, 1.6f, width * .391f, .19f, 3.2f, width * .235f);
Box(0x263744, x, 1.6f, -width * .414f, .19f, 3.2f, width * .18f);
float x = -span * .5f + bayLength * rib * .5f;
Box(Rib, x, 2.96f, 0, .15f, .23f, halfWidth * 2);
if (rib == Areas.Length * 2)
continue;
float fixtureX = x + bayLength * .25f;
Light(fixtureX, 0, 2.90f, 1.26f);
for (int side = -1; side <= 1; side += 2)
Light(fixtureX, side * Mathf.Lerp(CorridorHalfWidth, halfWidth, .55f), 2.93f, 1.4f);
}
}
private void BuildArea(int area, float x, int accent)
private void BuildBay(int area, float x)
{
float wall = width * .5f;
float z = Mathf.Min(3.25f, wall - 1.35f);
float xLeft = x - bayLength * .5f;
float roomWidth = halfWidth - CorridorHalfWidth;
for (int side = -1; side <= 1; side += 2)
{
if (area > 0)
Box(Wall, xLeft, CeilingHeight * .5f, side * (CorridorHalfWidth + roomWidth * .5f), .15f, CeilingHeight, roomWidth, true);
float wallLength = (bayLength - doorway) * .5f;
for (int end = -1; end <= 1; end += 2)
{
float px = x + end * (bayLength + doorway) * .25f;
Box(Wall, px, CeilingHeight * .5f, side * CorridorHalfWidth, wallLength, CeilingHeight, .14f, true);
Box(WallBase, px, .34f, side * (CorridorHalfWidth - .078f), wallLength - .04f, .60f, .035f);
Box(Rib, x + end * (doorway * .5f + .045f), 1.10f, side * CorridorHalfWidth, .116f, 2.20f, .21f, true);
}
Box(Wall, x, 2.66f, side * CorridorHalfWidth, doorway, .89f, .14f);
Box(Rib, x, 2.215f, side * CorridorHalfWidth, doorway + .19f, .12f, .24f);
Box(SteelDark, x, .022f, side * CorridorHalfWidth, doorway, .045f, .32f);
Box(Grating, x, .048f, side * CorridorHalfWidth, doorway - .13f, .016f, .29f);
}
Box(Dark, x, 2.55f, CorridorHalfWidth - .084f, Mathf.Min(doorway - .12f, 2.68f), .295f, .04f);
Sign(StationLabels[area], x, 2.55f, CorridorHalfWidth - .111f, .034f, White);
Box(Warning, x, 2.37f, CorridorHalfWidth - .092f, .27f, .026f, .037f);
float z = halfWidth - 1.13f;
float workSpan = Mathf.Min(bayLength - .90f, 7f);
switch (area)
{
case 0:
for (int side = -1; side <= 1; side += 2)
{
Box(0x3D484B, x, .16f, side * z, 5.4f, .33f, 1.75f);
Box(accent, x, .69f, side * z, 4.7f, .92f, 1.35f);
Pipe(0x526A74, new Vector3(x - 3.05f, .69f, side * z), new Vector3(x + 2.35f, .69f, side * z), .18f);
for (int i = -2; i <= 2; i++)
{
Box(0x7B8584, x + i * .86f, 1.27f, side * z, .51f, .30f, .80f);
Pipe(0xAA8170, new Vector3(x + i * .86f, 1.38f, side * z), new Vector3(x + i * .86f, 2.64f, side * z), .079f);
}
}
Panel(x + 2.94f, z, 0x62F0B4);
break;
case 1:
Box(0x92A19F, x, .49f, z, 5.40f, .92f, 1.54f);
Box(0xC7C8B9, x, 1.00f, z, 5.65f, .14f, 1.69f);
for (int i = 0; i < 3; i++)
{
float px = x - 1.65f + i * 1.66f;
Box(0x293943, px, 1.10f, z, 1.12f, .08f, 1.08f);
Pipe(accent, new Vector3(px, 1.12f, z), new Vector3(px, 1.38f, z), .26f);
}
Box(0x657478, x, 2.29f, z + .1f, 5.49f, .42f, 1.55f);
Box(0x839690, x, .61f, -z, 3.8f, 1.22f, 1.55f);
break;
case 2:
for (int shelf = 1; shelf <= 3; shelf++)
{
float level = shelf * .62f;
Box(0x655C48, x, level, z, 5.4f, .10f, 1.40f);
for (int i = -2; i <= 2; i++)
Box(i % 2 == 0 ? accent : 0xAF8F70, x + .91f * i, level + .21f, z, .70f, .36f, .76f);
}
for (int side = -1; side <= 1; side += 2)
Box(0x626B62, x + side * 2.45f, 1.13f, z, .12f, 2.26f, 1.59f);
break;
case 3:
Box(0x656B69, x, .48f, z, 5.30f, .93f, 1.35f);
Box(accent, x, .99f, z, 5.53f, .13f, 1.5f);
Box(0x4D6062, x, 1.83f, z + .65f, 5.30f, 1.01f, .14f);
for (int i = -3; i <= 3; i++)
{
float px = x + .61f * i;
Pipe(0xD2CAAF, new Vector3(px, 1.51f, z + .53f), new Vector3(px, 1.96f, z + .53f), .043f);
Box(i % 2 == 0 ? 0xAC784C : 0x748C84, px, 1.42f, z + .53f, .12f, .18f, .14f);
}
Box(0x705E56, x, .59f, -z, 3.14f, 1.18f, 1.25f);
break;
default:
for (int i = -1; i <= 1; i++)
{
float px = x + 1.49f * i;
Pipe(accent, new Vector3(px, .35f, z), new Vector3(px, 2.40f, z), .56f, 16);
Pipe(0xC3BFA7, new Vector3(px, 2.34f, z), new Vector3(px, 2.72f, z), .105f);
Box(0x3F5358, px, 1.40f, z - .49f, .24f, .48f, .26f);
}
Pipe(accent, new Vector3(x - 2.85f, 2.7f, z), new Vector3(x + 2.85f, 2.7f, z), .12f);
Panel(x + 2.94f, z, accent);
break;
case 0: Machinery(x, z, workSpan); break;
case 1: Galley(x, z, workSpan); break;
case 2: Stores(x, z, workSpan); break;
case 3: Workshop(x, z, workSpan); break;
case 4: Plant(x, z, workSpan, true); break;
case 5: Plant(x, z, workSpan, false); break;
}
}
private void Panel(float x, float z, int signal)
private void Machinery(float x, float z, float span)
{
Box(0x48595E, x, .66f, z, .96f, 1.32f, .83f);
Box(0x223240, x, 1.32f, z - .16f, 1.02f, .39f, .65f);
for (int i = -1; i <= 1; i++)
Box(signal, x + i * .21f, 1.38f, z - .493f, .08f, .08f, .022f);
float engineLength = span * .63f;
for (int side = -1; side <= 1; side += 2)
{
float px = x - span * .13f;
float pz = side * (z - .48f);
Box(Dark, px, .10f, pz, engineLength + .59f, .19f, 1.53f, true);
Box(Motor, px, .65f, pz, engineLength, .81f, 1.05f);
Box(SteelDark, px, 1.07f, pz, engineLength - .08f, .17f, .98f);
Box(Rubber, px + engineLength * .31f, .65f, pz - side * .55f, engineLength * .29f, .45f, .055f);
Pipe(SteelDark, new Vector3(px - engineLength * .64f, .67f, pz), new Vector3(px - engineLength * .48f, .67f, pz), .43f, 18);
for (int i = 0; i < 5; i++)
{
float piston = px - engineLength * .40f + engineLength * .19f * i;
Box(Motor, piston, 1.17f, pz, engineLength * .15f, .19f, .69f);
Pipe(Steel, new Vector3(piston, 1.26f, pz), new Vector3(piston, 1.54f, pz + .26f), .074f, 12);
Pipe(Steel, new Vector3(piston, 1.54f, pz + .26f), new Vector3(piston, 1.54f, pz + .55f), .074f, 12);
Box(SteelDark, piston, .68f, pz - side * .53f, .059f, .55f, .061f);
}
Pipe(Steel, new Vector3(px - engineLength * .47f, 1.54f, pz + .55f), new Vector3(px + engineLength * .49f, 1.54f, pz + .55f), .112f, 14);
for (int i = 0; i < 9; i++)
Box(SteelDark, px + engineLength * (.188f + .029f * i), .66f, pz - side * .587f, .041f, .35f, .035f);
Box(Warning, px - engineLength * .29f, .64f, pz - side * .544f, .22f, .13f, .018f);
Box(Warning, px, .01f, pz - side * 1.00f, engineLength + .62f, .017f, .039f);
Pipe(Steel, new Vector3(px - engineLength * .43f, 1.21f, pz + side * .37f), new Vector3(px - engineLength * .43f, 2.72f, pz + side * .37f), .119f, 15);
}
ControlCabinet(x + span * .34f, z - .23f, 1.04f, "PROPULSION");
ControlCabinet(x + span * .36f, -z + .28f, .91f, null);
}
private void Sign(string words, float x, float y, float z, Color color)
private void Galley(float x, float z, float span)
{
float range = span * .70f;
float px = x - span * .12f;
Counter(SteelDark, px, z + .05f, range, .91f);
Box(Steel, px, 1.94f, z + .41f, range + .14f, 1.31f, .11f);
Box(Steel, px, 2.11f, z + .09f, range + .38f, .32f, 1.15f);
Box(Rubber, px, 1.938f, z - .05f, range + .12f, .04f, .77f);
Box(FixtureLight, px, 1.904f, z - .38f, range * .84f, .025f, .055f);
for (int i = 0; i < 4; i++)
{
float sx = px + range * (.25f * i - .375f);
Box(Dark, sx, .53f, z - .39f, range * .20f, .37f, .020f);
Box(Steel, sx, .732f, z - .402f, range * .16f, .041f, .056f);
Pipe(Rubber, new Vector3(sx, .99f, z + .02f), new Vector3(sx, 1.042f, z + .02f), .18f, 18);
Pipe(Steel, new Vector3(sx, 1.043f, z + .02f), new Vector3(sx, 1.06f, z + .02f), .128f, 18);
Box(Amber, sx - .12f, .86f, z - .40f, .024f, .035f, .015f);
}
Counter(Steel, x, -z + .22f, span * .64f, 1.05f);
Box(White, x - span * .14f, 1.03f, -z + .24f, .54f, .071f, .38f);
Box(Red, x - span * .145f, 1.09f, -z + .18f, .24f, .065f, .24f);
ColdCabinet(x + span * .37f, z, .88f);
}
private void Stores(float x, float z, float span)
{
float rackWidth = span * .74f;
ProvisionRack(x - span * .12f, z + .10f, rackWidth, .74f);
ProvisionRack(x, -z + .13f, span * .78f, .74f);
ColdCabinet(x + span * .39f, z, .83f);
Box(Warning, x, .013f, z - .62f, span * .90f, .019f, .042f);
}
private void ProvisionRack(float x, float z, float span, float depth)
{
WalkSpace.Block(new Vector3(x, 1.07f, z), new Vector3(span, 2.14f, depth));
for (int level = 0; level < 3; level++)
{
float y = .26f + level * .59f;
Box(SteelDark, x, y, z, span, .09f, depth);
for (int bin = 0; bin < 6; bin++)
{
float bx = x + (bin - 2.5f) * span / 6;
float bWidth = span / 6 - .07f;
int color = ((level + bin * 2) % 4) switch { 0 => 0xAD875C, 1 => 0xB8A88A, 2 => 0x657F70, _ => 0xB2AB91 };
Box(color, bx, y + .24f, z, bWidth, .38f, depth - .15f);
Box(White, bx - bWidth * .28f, y + .26f, z - Mathf.Sign(z) * (depth * .5f - .074f), .12f, .083f, .014f);
}
}
for (int side = -1; side <= 1; side += 2)
for (int brace = -1; brace <= 1; brace += 2)
Box(SteelDark, x + side * (span * .5f - .04f), 1.05f, z + brace * (depth * .5f - .042f), .081f, 2.10f, .075f);
}
private void Workshop(float x, float z, float span)
{
float bench = span * .78f;
Counter(SteelDark, x, z + .12f, bench, .81f);
Box(Dark, x, 1.57f, z + .54f, bench, .86f, .073f);
Box(FixtureLight, x, 2.01f, z + .48f, bench * .84f, .04f, .085f);
for (int i = 0; i < 6; i++)
{
float handleX = x + (i - 2.5f) * bench / 7;
Pipe(Steel, new Vector3(handleX, 1.34f, z + .48f), new Vector3(handleX + .06f, 1.73f, z + .48f), .032f);
Box(Warning, handleX, 1.34f, z + .48f, .08f, .102f, .042f);
}
Box(Red, x - bench * .22f, 1.08f, z + .13f, .47f, .35f, .52f);
Box(Steel, x - bench * .22f, 1.22f, z + .13f, .53f, .082f, .55f);
float lockerX = x + span * .22f;
Box(Dark, lockerX, .70f, -z, 1.32f, 1.39f, .62f, true);
for (int i = 0; i < 5; i++)
{
float y = .22f + i * .22f;
Box(Red, lockerX, y, -z + .328f, 1.21f, .18f, .071f);
Box(Steel, lockerX, y + .03f, -z + .376f, .69f, .034f, .021f);
}
ColdCabinet(x - span * .26f, -z, .81f);
}
private void Plant(float x, float z, float span, bool fresh)
{
int paint = fresh ? Water : Waste;
string label = fresh ? "POTABLE" : "BIOREACTOR";
float start = x - span * .33f;
for (int side = -1; side <= 1; side += 2)
{
float pz = side * (z - .22f);
for (int i = 0; i < 3; i++)
{
float tankX = start + i * span * .239f;
float tankRadius = Mathf.Min(.49f, span * .103f);
Box(Dark, tankX, .14f, pz, tankRadius * 2.27f, .25f, tankRadius * 2.25f, true);
Pipe(paint, new Vector3(tankX, .24f, pz), new Vector3(tankX, 2.15f, pz), tankRadius, 22);
for (int band = 0; band <= 2; band++)
{
float height = .38f + band * .79f;
Pipe(SteelDark, new Vector3(tankX, height, pz), new Vector3(tankX, height + .081f, pz), tankRadius + .018f, 22);
}
Pipe(Steel, new Vector3(tankX, 2.10f, pz), new Vector3(tankX, 2.65f, pz), .094f, 13);
Pipe(White, new Vector3(tankX, 1.23f, pz - side * (tankRadius - .01f)), new Vector3(tankX, 1.23f, pz - side * (tankRadius + .092f)), .112f, 18);
Box(Warning, tankX, .98f, pz - side * (tankRadius + .012f), .19f, .09f, .024f);
}
Pipe(paint, new Vector3(start - .19f, 2.64f, pz), new Vector3(x + span * .31f, 2.64f, pz), .113f, 14);
Pipe(SteelDark, new Vector3(start - .16f, .49f, pz - side * .28f), new Vector3(x + span * .36f, .49f, pz - side * .28f), .093f, 14);
}
ControlCabinet(x + span * .37f, z, .80f, label);
}
private void Counter(int finish, float x, float z, float span, float depth)
{
Box(finish, x, .43f, z, span, .82f, depth - .09f);
Box(Steel, x, .91f, z, span + .12f, .13f, depth, true);
Box(Rubber, x, .08f, z, span, .16f, depth - .21f);
}
private void ColdCabinet(float x, float z, float width)
{
float front = z - Mathf.Sign(z) * .49f;
Box(SteelDark, x, 1.04f, z, width, 2.08f, .95f, true);
Box(Steel, x, 1.11f, front, width - .095f, 1.71f, .11f);
Box(Dark, x, .14f, front, width - .14f, .14f, .079f);
for (int vent = 0; vent < 5; vent++)
Box(Steel, x, .099f + vent * .019f, front - Mathf.Sign(z) * .042f, width - .20f, .009f, .022f);
Pipe(Rubber, new Vector3(x - width * .27f, .79f, front - Mathf.Sign(z) * .068f),
new Vector3(x - width * .27f, 1.14f, front - Mathf.Sign(z) * .068f), .039f);
}
private void ControlCabinet(float x, float z, float width, string words)
{
float side = Mathf.Sign(z);
float face = z - side * .334f;
Box(SteelDark, x, .91f, z, width, 1.82f, .68f, true);
Box(Steel, x, .90f, face, width - .052f, 1.55f, .047f);
Box(Dark, x, 1.30f, face - side * .028f, width * .69f, .36f, .021f);
Box(Monitor, x, 1.32f, face - side * .043f, width * .53f, .22f, .019f);
for (int row = 0; row < 4; row++)
Box(SteelDark, x, 1.26f + row * .04f, face - side * .055f, width * .42f, .012f, .011f);
for (int lamp = -1; lamp <= 1; lamp++)
Box(lamp == 1 ? Amber : EmergencyLight, x + lamp * width * .17f, .99f, face - side * .038f, .054f, .040f, .019f);
if (words != null)
Sign(words, x, 1.63f, face - side * .040f, .035f, Dark);
}
private void Light(float x, float z, float y, float length)
{
Box(SteelDark, x, y, z, length + .12f, .10f, .25f);
Box(FixtureLight, x, y - .057f, z, length, .034f, .135f);
}
private void Sign(string words, float x, float y, float z, float size, int color)
{
var game = new GameObject(words, typeof(TextMesh));
game.layer = 8;
game.transform.SetParent(Root.transform, false);
game.transform.localPosition = new Vector3(x, y, z);
var text = game.GetComponent<TextMesh>();
Font font = Resources.Load<Font>("Interface");
text.font = font;
text.text = words;
text.fontStyle = FontStyle.Bold;
text.fontSize = 52;
text.characterSize = .10f;
text.fontSize = 48;
text.characterSize = size;
text.anchor = TextAnchor.MiddleCenter;
text.color = color;
text.color = ColorOf(color);
game.GetComponent<MeshRenderer>().sharedMaterial = font.material;
}
@@ -187,10 +346,16 @@ namespace Soundings
return mesh;
}
private void Box(int color, float x, float y, float z, float w, float h, float d) =>
Paint(color).Box(new Vector3(x, y, z), new Vector3(w, h, d));
private void Box(int color, float x, float y, float z, float w, float h, float d, bool solid = false)
{
var center = new Vector3(x, y, z);
var size = new Vector3(w, h, d);
Paint(color).Box(center, size);
if (solid)
WalkSpace.Block(center, size);
}
private void Pipe(int color, Vector3 from, Vector3 to, float radius, int sides = 9) => Paint(color).Rod(from, to, radius, sides);
private void Pipe(int color, Vector3 from, Vector3 to, float radius, int sides = 10) => Paint(color).Rod(from, to, radius, sides);
private static Color32 ColorOf(int rgb) => new Color32((byte)(rgb >> 16), (byte)(rgb >> 8), (byte)rgb, 255);