GruppeC/frontend/SmartLectureRoom/Assets/SmartRoom/Scripts/Room/RoomBuilder.cs

393 lines
24 KiB
C#

using UnityEngine;
namespace SmartRoom
{
/// <summary>
/// Baut den Vorlesungsraum komplett prozedural auf (keine externen Assets nötig).
/// Koordinaten: x = links(-)/rechts(+), z = hinten(-)/vorne(+, Leinwand), y = oben.
/// Links: Fensterfront mit Außenjalousien und Heizkörpern. Vorne: Leinwand mittig, Tür links davon.
/// Rechts: geschlossene Wand.
/// </summary>
public static class RoomBuilder
{
public const float W = 12f, D = 14f, H = 3.6f, T = 0.25f;
public const float SillY = 0.9f, WinTopY = 2.8f, WinWidth = 2.2f;
public const float DoorX0 = -4.8f, DoorX1 = -3.6f, DoorH = 2.25f;
public const float ScreenW = 4.6f, ScreenTop = 3.22f, ScreenDrop = 2.25f;
public static readonly float[] WindowZ = { -4.5f, -1.5f, 1.5f, 4.5f };
public static readonly float[] VentZ = { -3.2f, 2.4f };
public static readonly Color Accent = new Color(0.16f, 0.70f, 0.75f);
static Material wall, accentWall, floor, ceiling, frame, glass, alu, white, oak, doorWood, dark, seat, metal,
grass, leaves, bark, stone, exitSign, heaterMat, panelMat, ledMat, lensMat, slideMat, slideAccent, screenMat;
public static RoomDevices Build(Transform root)
{
CreateMaterials();
var devices = root.GetComponent<RoomDevices>();
if (devices == null) devices = root.gameObject.AddComponent<RoomDevices>();
BuildShell(Prim.Pivot("Gebäude", root, Vector3.zero));
BuildOutside(Prim.Pivot("Außenbereich", root, Vector3.zero));
BuildWindows(Prim.Pivot("Fenster", root, Vector3.zero), devices);
BuildBlinds(Prim.Pivot("Jalousien", root, Vector3.zero), devices);
BuildHeaters(Prim.Pivot("Heizkörper", root, Vector3.zero), devices);
BuildVentilation(Prim.Pivot("Lüftung", root, Vector3.zero), devices);
BuildLights(Prim.Pivot("Beleuchtung", root, Vector3.zero), devices);
BuildProjection(Prim.Pivot("Beamer & Leinwand", root, Vector3.zero), devices);
BuildDoor(Prim.Pivot("Tür", root, Vector3.zero), devices);
BuildFurniture(Prim.Pivot("Möblierung", root, Vector3.zero));
return devices;
}
static void CreateMaterials()
{
wall = Mat.Solid(new Color(0.92f, 0.92f, 0.90f), 0.1f);
accentWall = Mat.Solid(new Color(0.80f, 0.83f, 0.85f), 0.1f);
floor = Mat.Solid(new Color(0.30f, 0.33f, 0.37f), 0.45f);
ceiling = Mat.Solid(new Color(0.96f, 0.96f, 0.96f), 0.05f);
frame = Mat.Solid(new Color(0.20f, 0.21f, 0.23f), 0.45f, 0.3f);
glass = Mat.Transparent(new Color(0.75f, 0.88f, 0.95f, 0.18f));
alu = Mat.Solid(new Color(0.74f, 0.76f, 0.79f), 0.55f, 0.6f);
white = Mat.Solid(new Color(0.95f, 0.95f, 0.95f), 0.3f);
oak = Mat.Solid(new Color(0.80f, 0.67f, 0.50f), 0.35f);
doorWood = Mat.Solid(new Color(0.62f, 0.48f, 0.35f), 0.3f);
dark = Mat.Solid(new Color(0.16f, 0.17f, 0.19f), 0.35f, 0.2f);
seat = Mat.Solid(new Color(0.17f, 0.44f, 0.50f), 0.2f);
metal = Mat.Solid(new Color(0.70f, 0.72f, 0.75f), 0.6f, 0.8f);
grass = Mat.Solid(new Color(0.36f, 0.50f, 0.30f), 0.05f);
leaves = Mat.Solid(new Color(0.25f, 0.45f, 0.25f), 0.1f);
bark = Mat.Solid(new Color(0.35f, 0.27f, 0.20f), 0.1f);
stone = Mat.Solid(new Color(0.85f, 0.85f, 0.83f), 0.4f);
screenMat = Mat.Solid(new Color(0.97f, 0.97f, 0.97f), 0.05f);
exitSign = Mat.Emissive(new Color(0.1f, 0.6f, 0.3f), new Color(0.1f, 0.9f, 0.4f) * 1.5f);
heaterMat = Mat.Emissive(new Color(0.93f, 0.93f, 0.92f), Color.black);
panelMat = Mat.Emissive(new Color(0.9f, 0.9f, 0.9f), Color.white);
ledMat = Mat.Emissive(Color.gray, Color.black);
lensMat = Mat.Emissive(new Color(0.1f, 0.1f, 0.12f), Color.black);
slideMat = Mat.Emissive(Color.white, Color.black);
slideAccent = Mat.Emissive(Accent, Accent);
}
// ---------------------------------------------------------------- Gebäudehülle
static void BuildShell(Transform p)
{
Prim.Box("Boden", p, new Vector3(0, -0.05f, 0), new Vector3(W + 2 * T, 0.1f, D + 2 * T), floor);
Prim.Box("Decke", p, new Vector3(0, H + 0.05f, 0), new Vector3(W + 2 * T, 0.1f, D + 2 * T), ceiling);
Prim.Box("Wand rechts", p, new Vector3(W / 2 + T / 2, H / 2, 0), new Vector3(T, H, D + 2 * T), wall);
Prim.Box("Wand hinten", p, new Vector3(0, H / 2, -D / 2 - T / 2), new Vector3(W, H, T), wall);
// Vorderwand mit Türöffnung links von der Leinwand
float zf = D / 2 + T / 2;
Prim.Box("Wand vorne links", p, new Vector3((-W / 2 + DoorX0) / 2, H / 2, zf), new Vector3(DoorX0 + W / 2, H, T), wall);
Prim.Box("Wand vorne rechts", p, new Vector3((DoorX1 + W / 2) / 2, H / 2, zf), new Vector3(W / 2 - DoorX1, H, T), wall);
Prim.Box("Sturz Tür", p, new Vector3((DoorX0 + DoorX1) / 2, (DoorH + H) / 2, zf), new Vector3(DoorX1 - DoorX0, H - DoorH, T), wall);
Prim.Box("Akzentwand", p, new Vector3(0, H / 2, D / 2 - 0.011f), new Vector3(ScreenW + 2f, H, 0.02f), accentWall);
// Linke Wand mit vier Fensteröffnungen
float xl = -W / 2 - T / 2;
Prim.Box("Brüstung", p, new Vector3(xl, SillY / 2, 0), new Vector3(T, SillY, D + 2 * T), wall);
Prim.Box("Wand über Fenstern", p, new Vector3(xl, (WinTopY + H) / 2, 0), new Vector3(T, H - WinTopY, D + 2 * T), wall);
float prev = -D / 2 - T;
for (int i = 0; i <= WindowZ.Length; i++)
{
float next = i < WindowZ.Length ? WindowZ[i] - WinWidth / 2 : D / 2 + T;
Prim.Box("Pfeiler", p, new Vector3(xl, (SillY + WinTopY) / 2, (prev + next) / 2), new Vector3(T, WinTopY - SillY, next - prev), wall);
if (i < WindowZ.Length) prev = WindowZ[i] + WinWidth / 2;
}
}
static void BuildOutside(Transform p)
{
Prim.Box("Wiese", p, new Vector3(0, -0.13f, 0), new Vector3(90f, 0.06f, 90f), grass);
Prim.Box("Weg", p, new Vector3(-W / 2 - 3f, -0.095f, 0), new Vector3(2.4f, 0.01f, 60f), stone);
float[] tz = { -10f, -3.5f, 3f, 9.5f };
for (int i = 0; i < tz.Length; i++)
{
float x = -W / 2 - 11f - (i % 2) * 2.5f;
Prim.Cylinder("Stamm", p, new Vector3(x, 1.3f, tz[i]), 0.35f, 2.6f, bark);
Prim.Sphere("Krone", p, new Vector3(x, 3.7f, tz[i]), 3.4f, leaves);
}
}
// ---------------------------------------------------------------- Fenster (Dreh-Kipp)
static void BuildWindows(Transform parent, RoomDevices dev)
{
float h = WinTopY - SillY;
const float fp = 0.07f; // Profilbreite Blendrahmen
const float sp = 0.06f; // Profilbreite Flügel
float fx = T / 2 - 0.06f; // Fensterebene (lokal, nahe Innenseite)
float sw = WinWidth - 2 * fp, sh = h - 2 * fp;
for (int i = 0; i < WindowZ.Length; i++)
{
var root = Prim.Pivot($"Fenster {i + 1}", parent, new Vector3(-W / 2 - T / 2, 0, WindowZ[i]));
Prim.Box("Rahmen oben", root, new Vector3(fx, WinTopY - fp / 2, 0), new Vector3(0.1f, fp, WinWidth), frame);
Prim.Box("Rahmen unten", root, new Vector3(fx, SillY + fp / 2, 0), new Vector3(0.1f, fp, WinWidth), frame);
Prim.Box("Rahmen links", root, new Vector3(fx, SillY + h / 2, -WinWidth / 2 + fp / 2), new Vector3(0.1f, h, fp), frame);
Prim.Box("Rahmen rechts", root, new Vector3(fx, SillY + h / 2, WinWidth / 2 - fp / 2), new Vector3(0.1f, h, fp), frame);
// Drehachse (vertikal) -> Kippachse (unten) -> Flügel
var hinge = Prim.Pivot("Drehachse", root, new Vector3(fx, SillY + fp, -WinWidth / 2 + fp));
var tilt = Prim.Pivot("Kippachse", hinge, Vector3.zero);
Prim.Box("Flügel unten", tilt, new Vector3(0, sp / 2, sw / 2), new Vector3(0.07f, sp, sw), frame);
Prim.Box("Flügel oben", tilt, new Vector3(0, sh - sp / 2, sw / 2), new Vector3(0.07f, sp, sw), frame);
Prim.Box("Flügel links", tilt, new Vector3(0, sh / 2, sp / 2), new Vector3(0.07f, sh, sp), frame);
Prim.Box("Flügel rechts", tilt, new Vector3(0, sh / 2, sw - sp / 2), new Vector3(0.07f, sh, sp), frame);
Prim.NoShadows(Prim.Box("Glas", tilt, new Vector3(0, sh / 2, sw / 2), new Vector3(0.012f, sh - 2 * sp, sw - 2 * sp), glass));
Prim.Box("Rosette", tilt, new Vector3(0.04f, sh / 2, sw - 0.04f), new Vector3(0.02f, 0.07f, 0.035f), metal);
var handle = Prim.Pivot("Griff", tilt, new Vector3(0.055f, sh / 2, sw - 0.04f));
Prim.Box("Hebel", handle, new Vector3(0, -0.055f, 0), new Vector3(0.02f, 0.12f, 0.025f), metal);
var act = root.gameObject.AddComponent<WindowActuator>();
act.hinge = hinge;
act.tilt = tilt;
act.handle = handle;
dev.windows.Add(act);
Prim.Box("Fensterbank", parent, new Vector3(-W / 2 + 0.1f, SillY - 0.015f, WindowZ[i]), new Vector3(0.24f, 0.03f, WinWidth + 0.12f), stone);
}
}
// ---------------------------------------------------------------- Außenjalousien (Raffstore)
static void BuildBlinds(Transform parent, RoomDevices dev)
{
const int n = 22;
float len = WinWidth + 0.04f;
for (int i = 0; i < WindowZ.Length; i++)
{
var root = Prim.Pivot($"Jalousie {i + 1}", parent, new Vector3(-W / 2 - T - 0.08f, 0, WindowZ[i]));
Prim.Box("Blende", root, new Vector3(-0.01f, WinTopY + 0.11f, 0), new Vector3(0.18f, 0.22f, WinWidth + 0.16f), frame);
float rh = WinTopY - SillY;
Prim.Box("Führungsschiene", root, new Vector3(0, SillY + rh / 2, len / 2 + 0.025f), new Vector3(0.05f, rh, 0.025f), frame);
Prim.Box("Führungsschiene", root, new Vector3(0, SillY + rh / 2, -len / 2 - 0.025f), new Vector3(0.05f, rh, 0.025f), frame);
var slats = new Transform[n];
for (int k = 0; k < n; k++)
slats[k] = Prim.Box($"Lamelle {k + 1}", root, Vector3.zero, new Vector3(0.085f, 0.006f, len), alu).transform;
var rail = Prim.Box("Endschiene", root, Vector3.zero, new Vector3(0.09f, 0.03f, len), frame).transform;
var act = root.gameObject.AddComponent<BlindActuator>();
act.slats = slats;
act.bottomRail = rail;
act.top = WinTopY - 0.01f;
act.bottom = SillY + 0.02f;
act.stackBase = WinTopY + 0.02f;
act.Apply();
dev.blinds.Add(act);
}
}
// ---------------------------------------------------------------- Heizkörper
static void BuildHeaters(Transform parent, RoomDevices dev)
{
const int fins = 16;
const float width = 1.6f;
for (int i = 0; i < WindowZ.Length; i++)
{
var root = Prim.Pivot($"Heizkörper {i + 1}", parent, new Vector3(-W / 2 + 0.09f, 0, WindowZ[i]));
for (int f = 0; f < fins; f++)
{
float z = -width / 2 + (f + 0.5f) * width / fins;
Prim.Box("Rippe", root, new Vector3(0, 0.46f, z), new Vector3(0.08f, 0.56f, 0.06f), heaterMat);
}
Prim.Box("Sammler unten", root, new Vector3(0, 0.2f, 0), new Vector3(0.05f, 0.04f, width), heaterMat);
Prim.Box("Sammler oben", root, new Vector3(0, 0.72f, 0), new Vector3(0.05f, 0.04f, width), heaterMat);
Prim.Box("Rohr", root, new Vector3(-0.02f, 0.1f, -width / 2 - 0.05f), new Vector3(0.025f, 0.2f, 0.025f), white);
var valve = Prim.Cylinder("Thermostatkopf", root, new Vector3(0, 0.72f, width / 2 + 0.06f), 0.06f, 0.1f, white);
valve.transform.localRotation = Quaternion.Euler(90f, 0, 0);
var heat = Fx.Make("Wärme", root, new Vector3(0.05f, 0.8f, 0), Quaternion.Euler(-90f, 0, 0),
new Color(1f, 0.6f, 0.35f, 0.22f), 0.14f, 2.5f, 0.25f,
ParticleSystemShapeType.Box, new Vector3(0.08f, width, 0.01f));
var act = root.gameObject.AddComponent<HeaterActuator>();
act.finMaterial = heaterMat;
act.heatFx = heat;
dev.heaters.Add(act);
}
}
// ---------------------------------------------------------------- Lüftungsanlage
static void BuildVentilation(Transform parent, RoomDevices dev)
{
var duct = Prim.Cylinder("Lüftungskanal", parent, new Vector3(0, H - 0.32f, -0.4f), 0.44f, D - 2.6f, metal);
duct.transform.localRotation = Quaternion.Euler(90f, 0, 0);
foreach (float z in new[] { -5f, -0.4f, 4.2f })
Prim.Box("Abhängung", parent, new Vector3(0, H - 0.05f, z), new Vector3(0.03f, 0.1f, 0.03f), dark);
for (int i = 0; i < VentZ.Length; i++)
{
var u = Prim.Pivot($"Lüftungsgerät {i + 1}", parent, new Vector3(0, H - 0.6f, VentZ[i]));
Prim.Box("Gehäuse", u, new Vector3(0, 0.03f, 0), new Vector3(0.95f, 0.16f, 0.95f), white);
Prim.Cylinder("Ring", u, new Vector3(0, -0.055f, 0), 0.74f, 0.02f, dark);
var rotor = Prim.Pivot("Rotor", u, new Vector3(0, -0.075f, 0));
Prim.Cylinder("Nabe", rotor, Vector3.zero, 0.13f, 0.04f, metal);
for (int b = 0; b < 5; b++)
{
var arm = Prim.Pivot("Arm", rotor, Vector3.zero);
arm.localRotation = Quaternion.Euler(0, b * 72f, 0);
var blade = Prim.Box("Blatt", arm, new Vector3(0.18f, 0, 0), new Vector3(0.26f, 0.008f, 0.09f), white);
blade.transform.localRotation = Quaternion.Euler(22f, 0, 0);
}
Prim.Box("Gitter", u, new Vector3(0, -0.1f, 0), new Vector3(0.7f, 0.01f, 0.02f), dark);
Prim.Box("Gitter", u, new Vector3(0, -0.1f, 0), new Vector3(0.02f, 0.01f, 0.7f), dark);
Prim.Box("Status-LED", u, new Vector3(0.476f, 0.05f, 0.3f), new Vector3(0.01f, 0.025f, 0.06f), ledMat);
var air = Fx.Make("Luftstrom", u, new Vector3(0, -0.11f, 0), Quaternion.Euler(90f, 0, 0),
new Color(0.75f, 0.88f, 1f, 0.3f), 0.1f, 2.2f, 0.8f,
ParticleSystemShapeType.Cone, Vector3.one, 35f, 0.3f);
var act = u.gameObject.AddComponent<VentilationActuator>();
act.rotor = rotor;
act.air = air;
act.led = ledMat;
dev.vents.Add(act);
}
}
// ---------------------------------------------------------------- Beleuchtung
static void BuildLights(Transform parent, RoomDevices dev)
{
var act = parent.gameObject.AddComponent<LightActuator>();
act.panelMaterial = panelMat;
foreach (float x in new[] { -3.2f, 3.2f })
{
foreach (float z in new[] { -5.2f, -1.9f, 1.4f, 4.7f })
{
Prim.Box("Leuchtenrahmen", parent, new Vector3(x, H - 0.01f, z), new Vector3(0.68f, 0.02f, 1.3f), white);
Prim.NoShadows(Prim.Box("Leuchtpanel", parent, new Vector3(x, H - 0.022f, z), new Vector3(0.62f, 0.01f, 1.24f), panelMat));
}
foreach (float z in new[] { -3.5f, 3.0f })
{
var go = new GameObject("Deckenlicht");
go.transform.SetParent(parent, false);
go.transform.localPosition = new Vector3(x, H - 0.4f, z);
var l = go.AddComponent<Light>();
l.type = LightType.Point;
l.range = 9f;
l.color = new Color(1f, 0.97f, 0.92f);
l.shadows = LightShadows.None;
act.lamps.Add(l);
}
}
dev.lights = act;
}
// ---------------------------------------------------------------- Leinwand + Beamer
static void BuildProjection(Transform parent, RoomDevices dev)
{
float zs = D / 2 - 0.1f;
Prim.Box("Leinwandkasten", parent, new Vector3(0, ScreenTop + 0.06f, zs), new Vector3(ScreenW + 0.2f, 0.12f, 0.12f), white);
var fabric = Prim.Box("Leinwand", parent, new Vector3(0, ScreenTop, zs), new Vector3(ScreenW, 0.04f, 0.006f), screenMat).transform;
var bar = Prim.Box("Leinwandstab", parent, new Vector3(0, ScreenTop, zs), new Vector3(ScreenW + 0.04f, 0.025f, 0.025f), dark).transform;
// Projiziertes Bild (Folie mit Live-Werten)
float sw = ScreenW - 0.3f, shh = ScreenDrop - 0.35f;
var slide = Prim.Pivot("Projektion", parent, new Vector3(0, ScreenTop - ScreenDrop / 2 - 0.05f, zs - 0.006f));
Prim.NoShadows(Prim.Box("Folie", slide, Vector3.zero, new Vector3(sw, shh, 0.002f), slideMat));
Prim.NoShadows(Prim.Box("Akzent", slide, new Vector3(-sw / 2 + 0.12f, 0, -0.002f), new Vector3(0.04f, shh - 0.3f, 0.002f), slideAccent));
var font = Prim.BuiltinFont();
float tx = -sw / 2 + 0.28f;
var title = Prim.Text("Titel", slide, new Vector3(tx, shh / 2 - 0.18f, -0.004f), "Smart Lecture Room", 0.031f, new Color(0.10f, 0.12f, 0.15f), font, FontStyle.Bold);
var sub = Prim.Text("Untertitel", slide, new Vector3(tx, shh / 2 - 0.42f, -0.004f), "Digitaler Zwilling · Raumklima live", 0.015f, new Color(0.35f, 0.4f, 0.45f), font);
var body = Prim.Text("Inhalt", slide, new Vector3(tx, shh / 2 - 0.72f, -0.004f), "", 0.017f, new Color(0.12f, 0.14f, 0.17f), font);
// Beamer an der Decke
var proj = Prim.Pivot("Beamer", parent, new Vector3(0, H - 0.28f, 1.2f));
Prim.Box("Halterung", proj, new Vector3(0, 0.15f, 0), new Vector3(0.05f, 0.26f, 0.05f), dark);
Prim.Box("Gehäuse", proj, Vector3.zero, new Vector3(0.42f, 0.13f, 0.34f), white);
var lens = Prim.Cylinder("Objektiv", proj, new Vector3(0.1f, 0, 0.175f), 0.09f, 0.03f, lensMat);
lens.transform.localRotation = Quaternion.Euler(90f, 0, 0);
var beamGo = new GameObject("Lichtkegel");
beamGo.transform.SetParent(proj, false);
beamGo.transform.localPosition = new Vector3(0.1f, 0, 0.2f);
Vector3 aim = parent.TransformPoint(new Vector3(0, ScreenTop - ScreenDrop / 2, zs));
beamGo.transform.rotation = Quaternion.LookRotation(aim - beamGo.transform.position);
var spot = beamGo.AddComponent<Light>();
spot.type = LightType.Spot;
spot.spotAngle = 40f;
spot.range = 10f;
spot.intensity = 0f;
spot.color = new Color(0.9f, 0.95f, 1f);
var act = parent.gameObject.AddComponent<ProjectorActuator>();
act.fabric = fabric;
act.bottomBar = bar;
act.top = ScreenTop;
act.maxDrop = ScreenDrop;
act.slide = slide.gameObject;
act.slideMaterial = slideMat;
act.lensMaterial = lensMat;
act.beam = spot;
act.texts = new[] { title, sub, body };
act.body = body;
dev.projector = act;
}
// ---------------------------------------------------------------- Tür
static void BuildDoor(Transform parent, RoomDevices dev)
{
float zf = D / 2 + T / 2, dw = DoorX1 - DoorX0, zi = D / 2 - 0.02f;
Prim.Box("Zarge links", parent, new Vector3(DoorX0 - 0.03f, DoorH / 2, zi), new Vector3(0.06f, DoorH + 0.06f, 0.05f), frame);
Prim.Box("Zarge rechts", parent, new Vector3(DoorX1 + 0.03f, DoorH / 2, zi), new Vector3(0.06f, DoorH + 0.06f, 0.05f), frame);
Prim.Box("Zarge oben", parent, new Vector3((DoorX0 + DoorX1) / 2, DoorH + 0.03f, zi), new Vector3(dw + 0.12f, 0.06f, 0.05f), frame);
var hinge = Prim.Pivot("Türangel", parent, new Vector3(DoorX0 + 0.01f, 0, zf));
float lw = dw - 0.02f;
Prim.Box("Türblatt", hinge, new Vector3(lw / 2, (DoorH - 0.01f) / 2, 0), new Vector3(lw, DoorH - 0.01f, 0.05f), doorWood, keepCollider: true);
Prim.Box("Drücker innen", hinge, new Vector3(lw - 0.14f, 1.05f, -0.055f), new Vector3(0.14f, 0.02f, 0.025f), metal);
Prim.Box("Drücker außen", hinge, new Vector3(lw - 0.14f, 1.05f, 0.055f), new Vector3(0.14f, 0.02f, 0.025f), metal);
Prim.Box("Notausgang", parent, new Vector3((DoorX0 + DoorX1) / 2, DoorH + 0.26f, D / 2 - 0.03f), new Vector3(0.38f, 0.15f, 0.04f), exitSign);
Prim.Box("Raumpanel", parent, new Vector3(DoorX1 + 0.5f, 1.4f, D / 2 - 0.015f), new Vector3(0.22f, 0.15f, 0.02f), dark);
Prim.Box("Raumpanel Display", parent, new Vector3(DoorX1 + 0.5f, 1.4f, D / 2 - 0.027f), new Vector3(0.18f, 0.11f, 0.004f), slideAccent);
var act = hinge.gameObject.AddComponent<DoorActuator>();
act.pivot = hinge;
dev.door = act;
}
// ---------------------------------------------------------------- Möbel
static void BuildFurniture(Transform p)
{
float[] rows = { -5.6f, -4.05f, -2.5f, -0.95f, 0.6f, 2.15f };
float[] blocks = { -2.9f, 2.9f };
foreach (float z in rows)
{
foreach (float cx in blocks)
{
Prim.Box("Tisch", p, new Vector3(cx, 0.74f, z + 0.3f), new Vector3(4.2f, 0.03f, 0.55f), oak);
Prim.Box("Sichtblende", p, new Vector3(cx, 0.45f, z + 0.56f), new Vector3(4.2f, 0.55f, 0.02f), dark);
Prim.Box("Wange", p, new Vector3(cx - 2.08f, 0.37f, z + 0.3f), new Vector3(0.04f, 0.74f, 0.52f), dark);
Prim.Box("Wange", p, new Vector3(cx + 2.08f, 0.37f, z + 0.3f), new Vector3(0.04f, 0.74f, 0.52f), dark);
for (int j = 0; j < 4; j++)
Chair(p, new Vector3(cx - 1.575f + j * 1.05f, 0, z - 0.15f));
}
}
// Dozentenpult vorne rechts
Prim.Box("Pult", p, new Vector3(3.4f, 0.52f, 5.3f), new Vector3(1.0f, 1.04f, 0.6f), dark);
Prim.Box("Pultplatte", p, new Vector3(3.4f, 1.06f, 5.3f), new Vector3(1.1f, 0.04f, 0.7f), oak);
Prim.Box("Laptop", p, new Vector3(3.4f, 1.088f, 5.32f), new Vector3(0.34f, 0.015f, 0.24f), metal);
Prim.Box("Laptop Display", p, new Vector3(3.4f, 1.2f, 5.2f), new Vector3(0.34f, 0.22f, 0.012f), metal);
// Pflanze hinten rechts
Prim.Cylinder("Topf", p, new Vector3(5.3f, 0.25f, -6.3f), 0.45f, 0.5f, dark);
Prim.Sphere("Pflanze", p, new Vector3(5.3f, 0.95f, -6.3f), 0.9f, leaves);
}
static void Chair(Transform p, Vector3 at)
{
Prim.Box("Sitz", p, at + new Vector3(0, 0.46f, 0), new Vector3(0.46f, 0.05f, 0.44f), seat);
var back = Prim.Box("Lehne", p, at + new Vector3(0, 0.8f, -0.21f), new Vector3(0.46f, 0.38f, 0.04f), seat);
back.transform.localRotation = Quaternion.Euler(-8f, 0, 0);
Prim.Box("Säule", p, at + new Vector3(0, 0.23f, 0), new Vector3(0.05f, 0.44f, 0.05f), dark);
Prim.Cylinder("Fuß", p, at + new Vector3(0, 0.015f, 0), 0.5f, 0.03f, dark);
}
}
}