using UnityEngine; namespace ServiceSim { /// /// 実際のファミレスに近い形の店。 /// 左に客席、右に厨房。厨房と客席のさかいに、奥から /// 「料理の受け渡し口」「パントリー」「下げ膳の返却口」が並ぶ。 /// その前を太い通路が南北に通る。下の壁に入口・待合・レジ、入口の右にトイレ。 /// /// 位置は「帯(部品の並び)の足し算」で決める。細い通路の幅を変えると /// 席の並びが詰まり、店の外寸もそれに合わせて変わる。 /// 数字はすべてこの .asset に置く。 /// /// 下の壁ぞい(南の帯)の並びは、西から東へ /// ブースの列 → 細い通路 → 壁卓3つ → ドリンクバー → 太い通路 → 待合・レジ・入口 /// ドリンクバーは奥行きが帯に入りきらないので、そこだけ壁を南へ出して /// くぼみ(アルコーブ)にする。待合・レジ・入口は、トイレを北へ寄せて空けた /// 太い通路の東の帯に置く。 /// [CreateAssetMenu(menuName = "ServiceSim/Store Layout (Band)", fileName = "StoreLayout_Family")] public class BandStoreLayout : StoreLayout { [Header("通路")] [Tooltip("太い通路の幅(m)。パントリーの前を南北に通る。ロボットの主な道")] public float mainAisleWidth = 1.6f; [Tooltip("上の島と下の島のあいだの横通路の幅(m)。固定")] public float crossAisleWidth = 1.2f; [Header("厨房とサービス(客席の東)")] [Tooltip("厨房・事務所の奥行き(X, m)")] public float kitchenDepthX = 10f; [Tooltip("パントリーなどのカウンターの奥行き(X, m)")] public float serviceStripDepth = 0.8f; [Tooltip("トイレの大きさ(X, Z, m)。客席側(西)に扉が1つ")] public Vector2 toiletSize = new Vector2(3.0f, 4.0f); [Tooltip("トイレの扉の幅(Z, m)")] public float toiletDoorWidthZ = 1.0f; [Tooltip("料理の受け渡し口の中心が、北の壁からどれだけ手前か(m)")] public float passFromNorthZ = 1.5f; [Tooltip("料理の受け渡し口の窓口の長さ(Z, m)")] public float passWindowLengthZ = 1.2f; [Tooltip("パントリーの北端が、北の壁からどれだけ手前か(m)")] public float pantryFromNorthZ = 2.5f; [Tooltip("パントリーのカウンターの長さ(Z, m)")] public float pantryLengthZ = 4.5f; [Tooltip("下げ膳の返却口の中心が、北の壁からどれだけ手前か(m)")] public float returnFromNorthZ = 8.0f; [Tooltip("返却口の窓口の長さ(Z, m)")] public float returnWindowLengthZ = 1.0f; [Header("席:左の壁ぞいのブース")] public int wallBoothCount = 8; [Tooltip("ブースの卓の大きさ(X, Z, m)")] public Vector2 boothTableSize = new Vector2(1.4f, 0.75f); [Tooltip("ベンチの奥行き(m)。座面+背もたれの合計")] public float benchDepth = 0.55f; [Tooltip("ベンチの座面の高さ(m)")] public float benchSeatHeight = 0.45f; [Tooltip("背もたれの板の厚み(m)。ベンチの奥行きのうち、この分が背もたれ")] public float benchBackThickness = 0.1f; [Tooltip("背もたれの高さ(m)。背中合わせの席では、これが仕切りを兼ねる")] public float benchHeight = 1.1f; [Tooltip("ベンチ1本を2つの座る場所に見せるとき、まん中に空けるすき間(m。片側ぶん)。見た目だけ")] public float benchSeatGapX = 0.05f; [Tooltip("座る場所の見た目の板の厚み(m)。座面の上に敷くだけ。見た目だけ")] public float benchSeatPadThickness = 0.02f; [Header("席:上下の壁ぞいの2人席")] [Tooltip("壁ぞいの2人席の卓の大きさ(X 壁に沿う向き, Z 奥行き, m)。壁側にベンチ1人、通路側に椅子1人")] public Vector2 wallTableSize = new Vector2(0.7f, 0.6f); [Tooltip("卓と卓のあいだのすき間(X, m。いちばん狭いところ)。ここを通って壁側の席に入る。" + "焼いた NavMesh の通行半径(navAgentRadius)の2倍より広くしないと人が通れない")] public float wallTableGapX = 0.6f; [Tooltip("卓の数を、いちばん狭い通路のときに入る数にそろえる。" + "通路の幅の条件どうしを比べられるようにするため。外すと幅ごとに入るだけ並べる")] public bool wallTableCountFromNarrowestAisle = true; [Tooltip("席の前(人が立つ点)を、椅子・ベンチのふちからどれだけ離すか(m)。席に入れるかの確かめに使う")] public float seatApproachGapZ = 0.3f; [Header("席:島の卓")] public int islandColumns = 3; public int islandTablesPerColumn = 3; [Tooltip("島の卓の大きさ(X, Z, m)")] public Vector2 islandTableSize = new Vector2(0.75f, 1.2f); [Tooltip("1列の中の卓どうしのすき間(Z, m)")] public float islandTableGapZ = 0.1f; [Header("椅子・卓の共通")] [Tooltip("椅子の奥行き(通路側へ出る分, m)")] public float chairDepth = 0.45f; [Tooltip("椅子の幅(m)")] public float chairWidth = 0.45f; public float chairHeight = 0.45f; public float tableHeight = 0.72f; [Tooltip("背中合わせの席のあいだの仕切りの高さ(m)")] public float dividerHeight = 1.1f; [Header("入口まわり")] [Tooltip("入口の幅(X, m)")] public float entranceWidthX = 2.0f; [Tooltip("風除室の奥行き(Z, m)")] public float vestibuleDepthZ = 1.2f; [Tooltip("待合の奥行き(Z, m)。0 なら下の壁ぞいの卓と同じ奥行きに合わせる")] public float waitingDepthZ = 0f; [Tooltip("レジの台の大きさ(X, Z, m)")] public Vector2 registerSize = new Vector2(1.0f, 0.5f); [Tooltip("レジの前に並ぶ点の数。会計に立つ人が1人ずつ並ぶ。埋まっていたら席で待つ")] public int registerQueueCount = 3; [Tooltip("レジの並ぶ点どうしの間隔(m)。レジの西へ順に並ぶ")] public float registerQueuePitch = 0.5f; [Tooltip("レジの内側(スタッフだけが入れる場所)の奥行き(Z, m)。" + "幅はレジの台と同じ(registerSize.x)。レジ台の北に取り、" + "太い通路(店の奥)からだけ入れる。客の並ぶ列や待合の中は通らない")] public float registerBackDepthZ = 1.2f; [Tooltip("レジの内側の入口(西側)に、歩ける幅としてこれだけは残す(m)。" + "奥行きがこれ+通行半径×2 より小さいときは、自動で広げる")] public float registerBackMinOpenZ = 0.7f; [Tooltip("ドリンクバーの台の大きさ(X, Z, m)")] public Vector2 drinkBarSize = new Vector2(3.6f, 0.7f); [Tooltip("カウンター類の高さ(m)")] public float counterHeight = 1.0f; [Tooltip("レジ・ドリンクバー・トイレの前に人が立つ余地(m)")] public float approachGap = 0.6f; [Header("待合の広さ(B4)")] [Tooltip("待合に立てる人数。この人数ぶんの広さを待合に確保する")] public int waitingStandCount = 8; [Tooltip("待合で1人が立つのに必要な広さ(m^2)")] public float waitingStandAreaM2 = 0.5f; [Header("ロボットの待機場所(B2)")] [Tooltip("待機させる台数ぶんの点の数")] public int robotStandbyCount = 2; [Tooltip("太い通路の東のふち(パントリーのカウンター面)から、待機の点までの距離(m)")] public float robotStandbySideOffset = 0.4f; [Tooltip("受け渡し口から南へ、1台めの待機の点までの距離(m)。パントリーのカウンターぎわに下がる")] public float robotStandbyFromPassZ = 1.6f; [Tooltip("待機の点どうしの間隔(m)。ロボットの直径より大きくする")] public float robotStandbyPitchZ = 0.8f; [Tooltip("待機中の台の西に残す通り道の幅(m)。これを下回ると報告に出す")] public float robotStandbyMinClearX = 0.55f; [Header("スタッフの待つ場所")] [Tooltip("手の空いたスタッフが待つ点の数(1人に1つ)")] public int staffStandbyCount = 2; [Tooltip("受け渡し口の窓口の北のふちから、待つ点までの距離(m)。" + "ロボットは受け渡し口より北へ行かないので、ここは通り道をふさがない")] public float staffStandbyFromPassZ = 0.45f; [Tooltip("待つ点どうしの間隔(X, m)。人の直径より大きくする")] public float staffStandbyPitchX = 0.6f; [Tooltip("太い通路の東のふちから、1人めの待つ点までの距離(m)")] public float staffStandbySideOffset = 0.4f; [Header("ドリンクバー(B4)")] [Tooltip("ドリンクバーの機械の数。前に立つ点をこの数だけ作る")] public int drinkBarStandCount = 4; [Tooltip("ドリンクバーの前に客が立つ場所の奥行き(m)")] public float drinkBarStandDepthZ = 1.5f; [Tooltip("ドリンクバーの端に並ぶ点の数")] public int drinkBarQueueCount = 3; [Tooltip("並ぶ点どうしの間隔(m)")] public float drinkBarQueuePitch = 0.5f; [Tooltip("並ぶ点の列の奥行き(m)。立つ場所の後ろに1列つくる")] public float drinkBarQueueDepthZ = 0.6f; [Tooltip("立つ場所・並ぶ点と、南の細い通路とのあいだに空ける分(m)")] public float drinkBarAisleClearZ = 0.1f; public override string StoreKindName { get { return "ファミレス型(客席+厨房+パントリー)"; } } // ---- 帯の足し算で出る値 ---- /// 島1列の幅(椅子+卓+椅子, m) public float IslandColumnWidthX { get { return chairDepth * 2f + islandTableSize.x; } } /// 島1列の奥行き(卓 n 個ぶん, m) public float IslandColumnDepthZ { get { return islandTablesPerColumn * islandTableSize.y + (islandTablesPerColumn - 1) * islandTableGapZ; } } /// ブース1つの奥行き(ベンチ+卓+ベンチ, m) public float BoothUnitZ { get { return benchDepth * 2f + boothTableSize.y; } } /// 壁沿いの卓の列の奥行き(椅子+卓+ベンチ, m) public float WallRowDepthZ { get { return chairDepth + wallTableSize.y + benchDepth; } } /// 南の帯(壁ぞいの卓の列)の奥行き(m) float FrontDepthZ { get { return WallRowDepthZ; } } float WaitingDepth { get { return waitingDepthZ > 0.0005f ? waitingDepthZ : FrontDepthZ; } } // 西から東への境目 float BoothColumnEastX { get { return boothTableSize.x; } } float Aisle1WestX { get { return BoothColumnEastX; } } float IslandWestX { get { return Aisle1WestX + AisleWidth; } } float IslandEastX { get { return IslandWestX + islandColumns * IslandColumnWidthX + (islandColumns - 1) * AisleWidth; } } float MainAisleWestX { get { return IslandEastX + AisleWidth; } } float MainAisleEastX { get { return MainAisleWestX + mainAisleWidth; } } float ServiceWallX { get { return MainAisleEastX + serviceStripDepth; } } float OuterEastX { get { return ServiceWallX + kitchenDepthX; } } float MainAisleCenterX { get { return MainAisleWestX + mainAisleWidth * 0.5f; } } // ---- 壁ぞいの2人席の並べ方 ---- // // 上の列は島の帯いっぱい、下の列はドリンクバーの手前までを使う。 // 「卓 wallTableSize.x + すき間 wallTableGapX」の繰り返しで、入るだけ並べる。 // すき間は、残った幅を等分して広げる(いちばん狭いところは .asset の値)。 // // 卓の数は、いちばん狭い通路のときに入る数にそろえる(wallTableCountFromNarrowestAisle)。 // 通路の幅を変えると壁の長さも変わるので、そろえないと条件ごとに卓の数が違ってしまい、 // 通路の幅の効果と卓の数の効果が混ざる。 /// 細い通路の幅が w のときの、壁ぞいの列が使える幅(m) float WallRowSpanXAt(float w) { return islandColumns * (IslandColumnWidthX + w); } /// 上の列が使える幅(m) float NorthRowSpanX { get { return WallRowSpanXAt(AisleWidth); } } /// 下の列が使える幅(m)。ドリンクバーのカウンターの分を引く float SouthRowSpanX { get { return WallRowSpanXAt(AisleWidth) - drinkBarSize.x; } } /// 数をそろえるときに使う幅(いちばん狭い通路のときの幅, m) float CountSpanX(bool north) { float w = wallTableCountFromNarrowestAisle ? MinAisleWidth : AisleWidth; float span = WallRowSpanXAt(w); return north ? span : span - drinkBarSize.x; } /// その幅に入る2人席の数 int WallTableCount(bool north) { float span = CountSpanX(north); float unit = wallTableSize.x + wallTableGapX; if (unit <= 0.0005f) return 0; return Mathf.Max(0, Mathf.FloorToInt((span + wallTableGapX) / unit + 0.0001f)); } public int NorthWallTableCount { get { return WallTableCount(true); } } public int SouthWallTableCount { get { return WallTableCount(false); } } /// /// 席の前の点を、通路やすき間の「歩ける帯」の中に収める(m)。 /// 焼いた NavMesh は通行半径ぶん削られるので、ふちに寄せすぎると /// 席に入れるのに「入れない」と出てしまう。 /// float SeatApproachInset(float corridorWidth) { float min = navAgentRadius + navVoxelSize; float max = Mathf.Max(min, corridorWidth - min); return Mathf.Clamp(seatApproachGapZ, min, max); } /// その列の、卓と卓のあいだのすき間(m)。残った幅を等分して広げる float WallTableGap(bool north) { int n = WallTableCount(north); if (n <= 1) return wallTableGapX; float span = north ? NorthRowSpanX : SouthRowSpanX; float even = (span - n * wallTableSize.x) / (n - 1); return Mathf.Max(wallTableGapX, even); } // 南から北への境目 float SouthRowNorthZ { get { return FrontDepthZ; } } float SouthAisleNorthZ { get { return SouthRowNorthZ + AisleWidth; } } float LowerIslandNorthZ { get { return SouthAisleNorthZ + IslandColumnDepthZ; } } float CrossAisleNorthZ { get { return LowerIslandNorthZ + crossAisleWidth; } } float UpperIslandNorthZ { get { return CrossAisleNorthZ + IslandColumnDepthZ; } } float NorthAisleNorthZ { get { return UpperIslandNorthZ + AisleWidth; } } /// 帯の足し算だけで出る北のふち(m)。北の壁ぞいの卓は、ここを壁側のふちにする float NorthRowOuterZ { get { return NorthAisleNorthZ + WallRowDepthZ; } } /// ブースの列の長さ(m) float BoothColumnNorthZ { get { return wallBoothCount * BoothUnitZ; } } /// /// 建物の北のふち(m)。帯の足し算と、ブースの列の長さの大きいほう。 /// ブースの列が長いときは、北の壁ぞいの卓の後ろ(壁とのあいだ)を壁でふさぐ。 /// float OuterNorthZ { get { return Mathf.Max(NorthRowOuterZ, BoothColumnNorthZ); } } /// 店の外寸(幅 × 奥行き, m。風除室とアルコーブは含まない) public Vector2 OuterSize { get { return new Vector2(OuterEastX, OuterNorthZ); } } // ---- ドリンクバー(南の帯の東寄り。太い通路の西のふちに寄せる)---- float DrinkBarEastX { get { return MainAisleWestX; } } float DrinkBarWestX { get { return DrinkBarEastX - drinkBarSize.x; } } /// カウンター+立つ場所+並ぶ点+通路との隙間に必要な奥行き(m) float DrinkBarNeedZ { get { return drinkBarSize.y + drinkBarStandDepthZ + drinkBarQueueDepthZ + drinkBarAisleClearZ; } } /// 南の帯に入りきらない分だけ、壁を南へ出す(くぼみの深さ, m) float DrinkBarAlcoveZ { get { return Mathf.Max(0f, DrinkBarNeedZ - FrontDepthZ); } } float DrinkBarSouthZ { get { return -DrinkBarAlcoveZ; } } float DrinkBarNorthZ { get { return DrinkBarSouthZ + drinkBarSize.y; } } float DrinkBarStandNorthZ { get { return DrinkBarNorthZ + drinkBarStandDepthZ; } } float DrinkBarQueueNorthZ { get { return DrinkBarStandNorthZ + drinkBarQueueDepthZ; } } // ---- 待合・レジ・入口(太い通路の東。トイレを北へ寄せて空けた帯)---- float FrontEastWestX { get { return MainAisleEastX; } } /// レジの台とレジの内側の東のふち(=トイレの西のふち, m) float RegisterEastX { get { return MainAisleEastX + registerSize.x; } } /// 待合・レジ・入口の帯の東のふち(m) float FrontEastEastX { get { return RegisterEastX + toiletSize.x; } } // レジの内側(スタッフだけが入れる場所)。 // レジ台の北、トイレの西。西(太い通路)からだけ入れる。 float RegisterBackSouthZ { get { return WaitingDepth; } } /// /// レジの内側の奥行き(m)。これが西の入口の幅になる。 /// 焼いた面で registerBackMinOpenZ を残せるよう、通行半径×2 を足した値を下回らせない。 /// float RegisterBackDepth { get { return Mathf.Max(registerBackDepthZ, registerBackMinOpenZ + navAgentRadius * 2f); } } float RegisterBackNorthZ { get { return RegisterBackSouthZ + RegisterBackDepth; } } /// レジの内側(スタッフだけが入れる場所)の広がり PlanRect RegisterBackRect { get { return new PlanRect(MainAisleEastX, RegisterBackSouthZ, RegisterEastX, RegisterBackNorthZ); } } float ToiletSouthZ { get { return WaitingDepth; } } float ToiletNorthZ { get { return ToiletSouthZ + toiletSize.y; } } /// 待合に必要な広さ(m^2) float WaitingNeedAreaM2 { get { return Mathf.Max(0, waitingStandCount) * waitingStandAreaM2; } } float IslandColumnWestX(int c) { return IslandWestX + c * (IslandColumnWidthX + AisleWidth); } /// 島の列と列のあいだ(および西端・東端)の細い通路の西のふち。c は 0..islandColumns float ColumnAisleWestX(int c) { if (c <= 0) return Aisle1WestX; return IslandColumnWestX(c - 1) + IslandColumnWidthX; } protected override StorePlan Compose() { StorePlan plan = new StorePlan(); float w = AisleWidth; float h = wallHeight; float t = wallThickness; float off = DeliveryOffset(); float outerX = OuterEastX; float outerZ = OuterNorthZ; // 床は建物の中だけ。風除室とアルコーブはその分だけ別に敷く(建物の外に床が出ないように) plan.AddFloor(new PlanRect(0f, 0f, outerX, outerZ)); // ---- 通路(0 番は太い通路)---- plan.AddAisle("MainAisle", new PlanRect(MainAisleWestX, 0f, MainAisleEastX, outerZ), false, new Vector3(MainAisleCenterX, 0f, OuterNorthZ * 0.5f)); int aisleSouthRow = plan.aisles.Count; plan.AddAisle("SouthAisle", new PlanRect(Aisle1WestX, SouthRowNorthZ, MainAisleWestX, SouthAisleNorthZ), true, MainAisleWaitPoint((SouthRowNorthZ + SouthAisleNorthZ) * 0.5f)); // 横通路は太い通路あつかい(卓の aisleIndex には使わない) plan.AddAisle("CrossAisle", new PlanRect(Aisle1WestX, LowerIslandNorthZ, MainAisleWestX, CrossAisleNorthZ), false, MainAisleWaitPoint((LowerIslandNorthZ + CrossAisleNorthZ) * 0.5f)); int aisleNorthRow = plan.aisles.Count; plan.AddAisle("NorthAisle", new PlanRect(Aisle1WestX, UpperIslandNorthZ, MainAisleWestX, NorthAisleNorthZ), true, MainAisleWaitPoint((UpperIslandNorthZ + NorthAisleNorthZ) * 0.5f)); // 南北に通る細い通路。横通路で上下に分ける int colAisleCount = islandColumns + 1; int[] colLower = new int[colAisleCount]; int[] colUpper = new int[colAisleCount]; for (int c = 0; c < colAisleCount; c++) { float ax0 = ColumnAisleWestX(c); float ax1 = ax0 + w; string nm = c == 0 ? "WestAisle" : "ColumnAisle" + c.ToString("00"); // 西端の通路(ブースの前)は、南北いっぱいに通す float lowZ0 = c == 0 ? 0f : SouthAisleNorthZ; float lowZ1 = LowerIslandNorthZ; float upZ0 = CrossAisleNorthZ; float upZ1 = c == 0 ? outerZ : UpperIslandNorthZ; colLower[c] = plan.aisles.Count; plan.AddAisle(nm + "_S", new PlanRect(ax0, lowZ0, ax1, lowZ1), true, MainAisleWaitPoint((lowZ0 + lowZ1) * 0.5f)); colUpper[c] = plan.aisles.Count; plan.AddAisle(nm + "_N", new PlanRect(ax0, upZ0, ax1, upZ1), true, MainAisleWaitPoint((upZ0 + upZ1) * 0.5f)); } // ---- 外の壁 ---- ComposeOuterWalls(plan, h, t); // ---- 厨房・事務所・トイレ・サービスの帯 ---- ComposeEastBlock(plan, h, t); // ---- 席 ---- int tableId = 1; ComposeBooths(plan, ref tableId, off, colLower, colUpper); ComposeWallRow(plan, ref tableId, true, off, aisleNorthRow); ComposeWallRow(plan, ref tableId, false, off, aisleSouthRow); ComposeIslands(plan, ref tableId, off, colLower, colUpper); // ---- 入口まわり(ドリンクバー・待合・レジ)---- ComposeFront(plan, h, t); // ---- 余りをふさぐ ---- // 北西の角(ブースの列より北) float boothEndZ = BoothColumnNorthZ; if (outerZ - boothEndZ > 0.0005f) plan.AddBox("NorthWestFiller", BoxStyle.Wall, new PlanRect(0f, boothEndZ, BoothColumnEastX, outerZ), h); // 北の壁ぞいの卓の後ろ(ブースの列のほうが長いときに出る余り)。 // 歩ける余地にすると北の通路が実質広がってしまうので、壁でふさぐ if (outerZ - NorthRowOuterZ > 0.0005f) plan.AddBox("NorthRowBackFiller", BoxStyle.Wall, new PlanRect(IslandWestX, NorthRowOuterZ, MainAisleWestX, outerZ), h); return plan; } /// 太い通路の上で待つ点(横にずらして、戻る台が通れるようにする) Vector3 MainAisleWaitPoint(float zoneCenterZ) { float z = Mathf.Clamp(zoneCenterZ - aisleEntranceSetback, 0.5f, OuterNorthZ - 0.5f); return new Vector3(MainAisleCenterX - aisleEntranceSideOffset, 0f, z); } /// 入口の中心(太い通路の東の帯のまん中) float EntranceCenterX() { // レジの台・レジの内側より東(客が並ぶ側)のまん中 return (RegisterEastX + FrontEastEastX) * 0.5f; } // ---------------- 外の壁 ---------------- void ComposeOuterWalls(StorePlan plan, float h, float t) { float outerX = OuterEastX; float outerZ = OuterNorthZ; float entranceCenterX = EntranceCenterX(); float eL = entranceCenterX - entranceWidthX * 0.5f; float eR = entranceCenterX + entranceWidthX * 0.5f; // 南の壁。ドリンクバーのくぼみと入口のところを空ける(西から東へ) float alcove = DrinkBarAlcoveZ; int seg = 0; if (alcove > 0.0005f) { AddSouthWall(plan, -t, DrinkBarWestX - t, h, t, ref seg); AddSouthWall(plan, DrinkBarEastX + t, eL, h, t, ref seg); } else { AddSouthWall(plan, -t, eL, h, t, ref seg); } AddSouthWall(plan, eR, outerX + t, h, t, ref seg); plan.AddBox("Wall_North", BoxStyle.Wall, new PlanRect(-t, outerZ, outerX + t, outerZ + t), h); plan.AddBox("Wall_West", BoxStyle.Wall, new PlanRect(-t, -t, 0f, outerZ + t), h); plan.AddBox("Wall_East", BoxStyle.Wall, new PlanRect(outerX, -t, outerX + t, outerZ + t), h); // ドリンクバーのくぼみ(アルコーブ)。南の帯の奥行きが足りない分だけ外へ出す if (alcove > 0.0005f) { float z0 = -alcove; plan.AddFloor(new PlanRect(DrinkBarWestX - t, z0 - t, DrinkBarEastX + t, 0f)); plan.AddBox("DrinkBarAlcove_S", BoxStyle.Wall, new PlanRect(DrinkBarWestX - t, z0 - t, DrinkBarEastX + t, z0), h); plan.AddBox("DrinkBarAlcove_W", BoxStyle.Wall, new PlanRect(DrinkBarWestX - t, z0, DrinkBarWestX, 0f), h); plan.AddBox("DrinkBarAlcove_E", BoxStyle.Wall, new PlanRect(DrinkBarEastX, z0, DrinkBarEastX + t, 0f), h); } // 風除室 if (vestibuleDepthZ > 0.0005f) { plan.AddFloor(new PlanRect(eL - t, -vestibuleDepthZ - t, eR + t, 0f)); plan.AddBox("Vestibule_W", BoxStyle.Wall, new PlanRect(eL - t, -vestibuleDepthZ - t, eL, 0f), h); plan.AddBox("Vestibule_E", BoxStyle.Wall, new PlanRect(eR, -vestibuleDepthZ - t, eR + t, 0f), h); plan.AddPlace(PlaceKind.Vestibule, "Vestibule", new PlanRect(eL, -vestibuleDepthZ, eR, 0f), 0f, new Vector3(entranceCenterX, 0f, -vestibuleDepthZ * 0.5f), false); plan.AddPlace(PlaceKind.Entrance, "Entrance", new PlanRect(eL, -0.1f, eR, 0.1f), 0f, new Vector3(entranceCenterX, 0f, 0.5f), false); } } void AddSouthWall(StorePlan plan, float x0, float x1, float h, float t, ref int seg) { if (x1 - x0 <= 0.0005f) return; seg++; plan.AddBox("Wall_South" + seg.ToString("00"), BoxStyle.Wall, new PlanRect(x0, -t, x1, 0f), h); } // ---------------- 東の塊(厨房・事務所・トイレ・サービス)---------------- void ComposeEastBlock(StorePlan plan, float h, float t) { float outerX = OuterEastX; float outerZ = OuterNorthZ; float mx = MainAisleEastX; // 太い通路の東のふち float sx = ServiceWallX; // サービスの帯の東のふち(厨房の壁) // トイレは、南の帯(待合・レジ・入口)を空けるために北へ寄せる float tz0 = ToiletSouthZ; float tz1 = ToiletNorthZ; // レジの内側は太い通路(西)から入れるので、 // トイレの西の壁は tz0(=レジの内側の北のふち)から上だけに立てる。 // 厨房(通れない) plan.AddPlace(PlaceKind.Kitchen, "Kitchen", new PlanRect(sx, tz1, outerX, outerZ), h, new Vector3((sx + outerX) * 0.5f, 0f, (tz1 + outerZ) * 0.5f), true); // 事務所・更衣室(通れない)。南の帯まで下ろして、余りを作らない float officeWestX = FrontEastEastX; plan.AddPlace(PlaceKind.Office, "Office", new PlanRect(officeWestX, 0f, outerX, tz1), h, new Vector3((officeWestX + outerX) * 0.5f, 0f, tz1 * 0.5f), true); // トイレ(西に扉。中は人が入れる)。 // 西のふちはレジの内側のぶん東へ寄せる(レジの内側は太い通路から入る) float twx = RegisterEastX; float doorC = (tz0 + tz1) * 0.5f; float doorZ0 = Mathf.Max(tz0 + 0.3f, doorC - toiletDoorWidthZ * 0.5f); float doorZ1 = Mathf.Min(tz1 - 0.3f, doorZ0 + toiletDoorWidthZ); plan.AddBox("ToiletWall_W_S", BoxStyle.Wall, new PlanRect(twx, tz0, twx + t, doorZ0), h); plan.AddBox("ToiletWall_W_N", BoxStyle.Wall, new PlanRect(twx, doorZ1, twx + t, tz1), h); plan.AddBox("ToiletWall_S", BoxStyle.Wall, new PlanRect(twx, tz0, officeWestX, tz0 + t), h); plan.AddBox("ToiletWall_N", BoxStyle.Wall, new PlanRect(twx, tz1 - t, officeWestX, tz1), h); plan.AddBox("ToiletWall_E", BoxStyle.Wall, new PlanRect(officeWestX - t, tz0, officeWestX, tz1), h); plan.AddPlace(PlaceKind.Toilet, "Toilet", new PlanRect(twx + t, tz0 + t, officeWestX - t, tz1 - t), 0f, new Vector3((twx + officeWestX) * 0.5f, 0f, doorC), false); // サービスの帯(受け渡し口・パントリー・返却口・残りは壁) float passC = outerZ - passFromNorthZ; float passZ0 = passC - passWindowLengthZ * 0.5f; float passZ1 = passC + passWindowLengthZ * 0.5f; float pantryZ1 = outerZ - pantryFromNorthZ; float pantryZ0 = pantryZ1 - pantryLengthZ; float retC = outerZ - returnFromNorthZ; float retZ0 = retC - returnWindowLengthZ * 0.5f; float retZ1 = retC + returnWindowLengthZ * 0.5f; plan.AddPlace(PlaceKind.FoodPass, "FoodPass", new PlanRect(mx, passZ0, sx, passZ1), counterHeight, new Vector3(MainAisleCenterX, 0f, passC), true); plan.AddPlace(PlaceKind.Pantry, "Pantry", new PlanRect(mx, pantryZ0, sx, pantryZ1), counterHeight, new Vector3(MainAisleCenterX, 0f, (pantryZ0 + pantryZ1) * 0.5f), true); // ロボットの待機場所(B2)。受け渡し口の前の点とは別にする。 // ・受け渡し口の南側(パントリーのカウンターぎわ)に下がる。 // 受け渡し口の前にはスタッフも料理を取りに来るので、ロボットが居座らないようにする // ・太い通路の東のふち(カウンター面)に寄せる。西のふちは細い通路の出入口なので使わない // ・受け渡し口・パントリー・返却口の前の点は、どれも太い通路の真ん中 // (スタッフが立つ点)なので、そこから外れた東のふちに置く // ・台どうしは robotStandbyPitchZ だけ南北に離す(重ならないように) // ・西側には通り道を残す(残りの幅は store_report に出す) float standbyX = MainAisleEastX - robotStandbySideOffset; float standbyZ0 = passC - robotStandbyFromPassZ; for (int i = 0; i < Mathf.Max(0, robotStandbyCount); i++) { float z = Mathf.Max(0.5f, standbyZ0 - i * robotStandbyPitchZ); plan.AddPlace(PlaceKind.RobotStandby, "RobotStandby" + (i + 1).ToString("00"), new PlanRect(0f, 0f, 0f, 0f), 0f, new Vector3(standbyX, 0f, z), false); } // 手の空いたスタッフが待つ点。 // 受け渡し口の窓口より北は太い通路の行き止まり(ロボットの行き先は // 受け渡し口・パントリー・返却口・待機場所で、すべてこれより南)なので、 // ここに2人ぶん並べればロボットの通り道をふさがない。 // パントリーのカウンターの先は厨房で通れないため、カウンターの内側には立てない。 for (int i = 0; i < Mathf.Max(0, staffStandbyCount); i++) { float x = mx - staffStandbySideOffset - i * staffStandbyPitchX; if (x < MainAisleWestX + 0.2f) break; float z = Mathf.Min(passZ1 + staffStandbyFromPassZ, outerZ - 0.45f); plan.AddPlace(PlaceKind.StaffStandby, "StaffStandby" + (i + 1).ToString("00"), new PlanRect(0f, 0f, 0f, 0f), 0f, new Vector3(x, 0f, z), false); } plan.AddPlace(PlaceKind.DishReturn, "DishReturn", new PlanRect(mx, retZ0, sx, retZ1), counterHeight, new Vector3(MainAisleCenterX, 0f, retC), true); // 帯の残りを壁でふさぐ(南から北へ、窓口とカウンターのあいだ) float[] marks = { tz1, retZ0, retZ1, pantryZ0, pantryZ1, passZ0, passZ1, outerZ }; for (int i = 0; i < marks.Length - 1; i += 2) { float z0 = marks[i], z1 = marks[i + 1]; if (z1 - z0 > 0.0005f) plan.AddBox("ServiceWall" + i, BoxStyle.Wall, new PlanRect(mx, z0, sx, z1), h); } } // ---------------- 席 ---------------- void ComposeBooths(StorePlan plan, ref int tableId, float off, int[] colLower, int[] colUpper) { float x0 = 0f, x1 = BoothColumnEastX; float unitZ = BoothUnitZ; float aisleCenterX = Aisle1WestX + AisleWidth * 0.5f; for (int i = 0; i < wallBoothCount; i++) { float z0 = i * unitZ; float tableZ0 = z0 + benchDepth; float tableZ1 = tableZ0 + boothTableSize.y; // 卓の手前と奥のベンチ(1本に2人ぶん)。背もたれは卓から遠い側に立てる AddBenchZ(plan, "BoothBench_S", x0, x1, z0, tableZ0, 2); AddBenchZ(plan, "BoothBench_N", x0, x1, z0 + unitZ, tableZ1, 2); PlanSeat seat = new PlanSeat(); seat.tableId = tableId++; seat.kind = SeatKind.WallBooth; seat.seatCount = 4; seat.tableRect = new PlanRect(x0, tableZ0, x1, tableZ1); seat.tableHeight = tableHeight; float cz = (tableZ0 + tableZ1) * 0.5f; seat.deliveryPoint = new Vector3(aisleCenterX - off, 0f, cz); seat.aisleIndex = cz < LowerIslandNorthZ ? colLower[0] : colUpper[0]; // 席の前の点。2人ぶんのベンチには、通路側から同じ口で入る float spotX = Aisle1WestX + SeatApproachInset(AisleWidth); seat.spots.Add(new PlanSeatSpot("南ベンチ(2人)", new Vector3(spotX, 0f, (z0 + tableZ0) * 0.5f))); seat.spots.Add(new PlanSeatSpot("北ベンチ(2人)", new Vector3(spotX, 0f, (tableZ1 + z0 + unitZ) * 0.5f))); plan.seats.Add(seat); // ブースは椅子を引かない(ベンチ) } } /// /// 壁ぞいの2人席の列。壁側にベンチ1人、通路側に椅子1人。 /// 卓と卓のあいだは仕切らず、すき間を空ける(ここを通って壁側の席に入る)。 /// void ComposeWallRow(StorePlan plan, ref int tableId, bool north, float off, int aisleIndex) { int count = WallTableCount(north); if (count <= 0) return; float tableW = wallTableSize.x; float gap = WallTableGap(north); float rowWestX = IslandWestX; // 北の列:壁側(北)にベンチ、通路側(南)に椅子。南の列はその逆。 // 北の列の壁側のふちは、帯の足し算で出る位置(建物の北のふちではない) float rowOuterZ = north ? NorthRowOuterZ : 0f; float dir = north ? -1f : 1f; // 壁から通路へ向かう向き float benchZ0 = rowOuterZ; float benchZ1 = rowOuterZ + dir * benchDepth; float tableZ0 = benchZ1; float tableZ1 = tableZ0 + dir * wallTableSize.y; float chairZ0 = tableZ1; float chairZ1 = chairZ0 + dir * chairDepth; // 壁側の席の前に立つ点の z。ベンチのまん中だが、壁に寄りすぎると // 焼いた NavMesh から外れるので、壁から通行半径ぶんは離す float benchStandZ = benchZ0 + dir * Mathf.Max(benchDepth * 0.5f, navAgentRadius + navVoxelSize); float aisleCenterZ = north ? (UpperIslandNorthZ + NorthAisleNorthZ) * 0.5f : (SouthRowNorthZ + SouthAisleNorthZ) * 0.5f; float deliveryZ = aisleCenterZ + (north ? off : -off); for (int i = 0; i < count; i++) { float tx0 = rowWestX + i * (tableW + gap); float tx1 = tx0 + tableW; float cx = (tx0 + tx1) * 0.5f; // 壁側のベンチ(1人ぶん) AddBenchZ(plan, "WallBench", tx0, tx1, benchZ0, benchZ1, 1); PlanSeat seat = new PlanSeat(); seat.tableId = tableId++; seat.kind = SeatKind.WallTable; seat.seatCount = 2; seat.tableRect = new PlanRect(tx0, tableZ0, tx1, tableZ1); seat.tableHeight = tableHeight; seat.deliveryPoint = new Vector3(cx, 0f, deliveryZ); seat.aisleIndex = aisleIndex; // 通路側の椅子1脚(引ける) PlanChair chair = new PlanChair(); chair.rect = new PlanRect(cx - chairWidth * 0.5f, Mathf.Min(chairZ0, chairZ1), cx + chairWidth * 0.5f, Mathf.Max(chairZ0, chairZ1)); chair.height = chairHeight; chair.pullable = true; chair.pullDirection = new Vector3(0f, 0f, dir); seat.chairs.Add(chair); // 席の前の点。 // 壁側:卓のとなりのすき間を通って入る。最後の卓は西側のすき間を使う // 通路側:椅子の通路側のふちから少し離れた点(通路の上) float gapCenterX = i < count - 1 ? tx1 + gap * 0.5f : tx0 - gap * 0.5f; seat.spots.Add(new PlanSeatSpot("壁側", new Vector3(gapCenterX, 0f, benchStandZ))); // 卓と卓のすき間は、人がロボットをよけて下がれる場所にもなる。 // 通路の外(卓の奥行きのまん中あたり)に取る if (i < count - 1) plan.refuges.Add(new Vector3(tx1 + gap * 0.5f, 0f, rowOuterZ + dir * (benchDepth + wallTableSize.y * 0.5f))); seat.spots.Add(new PlanSeatSpot("通路側", new Vector3(cx, 0f, chairZ1 + dir * SeatApproachInset(AisleWidth)))); plan.seats.Add(seat); } } /// /// ベンチ1つを、座面と背もたれに分けて置く。奥行きは /// 「背もたれ benchBackThickness + 座面(残り)」で、合わせて benchDepth。 /// zOuter は卓から遠い側(壁側・背中合わせの側)、zInner は卓に近い側。 /// 背もたれは zOuter 側に立てるので、背中合わせの席では仕切りを兼ねる。 /// /// 座面の上に「座る場所」の見た目を2つ敷く(1本=2人ぶん)。 /// これは当たりを持たない板なので、NavMesh・前のセンサー・左右の空きの測りには /// いっさい効かない(見た目だけ)。座面の箱そのものは1つのまま変えない。 /// void AddBenchZ(StorePlan plan, string name, float x0, float x1, float zOuter, float zInner, int seats) { float dir = zInner >= zOuter ? 1f : -1f; float back = zOuter + dir * Mathf.Min(benchBackThickness, Mathf.Abs(zInner - zOuter)); plan.AddBox(name + "_Back", BoxStyle.Bench, new PlanRect(x0, Mathf.Min(zOuter, back), x1, Mathf.Max(zOuter, back)), benchHeight); float seatZ0 = Mathf.Min(back, zInner); float seatZ1 = Mathf.Max(back, zInner); plan.AddBox(name + "_Seat", BoxStyle.Bench, new PlanRect(x0, seatZ0, x1, seatZ1), benchSeatHeight); AddBenchSeatLook(plan, name, x0, x1, seatZ0, seatZ1, seats); } /// /// 座る場所の見た目を、座面の上に seats 個ぶん敷く(当たりなし)。 /// 1本の長さを seats で割り、となりと接する側だけ benchSeatGapX ずつ詰めて四角にする /// (2人ぶんならまん中に benchSeatGapX × 2 のすき間が開く。1人ぶんなら詰めない)。 /// void AddBenchSeatLook(StorePlan plan, string name, float x0, float x1, float z0, float z1, int seats) { if (benchSeatPadThickness <= 0.0005f) return; if (seats <= 0) return; float cell = (x1 - x0) / seats; for (int i = 0; i < seats; i++) { float px0 = x0 + i * cell + (i > 0 ? benchSeatGapX : 0f); float px1 = x0 + (i + 1) * cell - (i < seats - 1 ? benchSeatGapX : 0f); if (px1 - px0 <= 0.05f) continue; // 短すぎて分けられない PlanBox b = plan.AddBox(name + "_SeatLook" + (i + 1), BoxStyle.BenchSeat, new PlanRect(px0, z0, px1, z1), benchSeatPadThickness); if (b != null) b.baseY = benchSeatHeight; // 座面の上に乗せる } } void ComposeIslands(StorePlan plan, ref int tableId, float off, int[] colLower, int[] colUpper) { float w = AisleWidth; for (int half = 0; half < 2; half++) { bool upper = half == 1; float z0 = upper ? CrossAisleNorthZ : SouthAisleNorthZ; for (int c = 0; c < islandColumns; c++) { float colX0 = IslandColumnWestX(c); float tableX0 = colX0 + chairDepth; float tableX1 = tableX0 + islandTableSize.x; float colX1 = tableX1 + chairDepth; // 料理は東側の通路から出す(西の通路に偏らないように) int eastAisle = upper ? colUpper[c + 1] : colLower[c + 1]; float eastAisleCenterX = ColumnAisleWestX(c + 1) + w * 0.5f; for (int r = 0; r < islandTablesPerColumn; r++) { float tz0 = z0 + r * (islandTableSize.y + islandTableGapZ); float tz1 = tz0 + islandTableSize.y; float cz = (tz0 + tz1) * 0.5f; PlanSeat seat = new PlanSeat(); seat.tableId = tableId++; seat.kind = SeatKind.IslandTable; seat.seatCount = 4; seat.tableRect = new PlanRect(tableX0, tz0, tableX1, tz1); seat.tableHeight = tableHeight; seat.deliveryPoint = new Vector3(eastAisleCenterX - off, 0f, cz); seat.aisleIndex = eastAisle; // 両側に椅子2脚ずつ(引ける) for (int side = -1; side <= 1; side += 2) { float cx0 = side < 0 ? colX0 : tableX1; float cx1 = side < 0 ? tableX0 : colX1; for (int k = -1; k <= 1; k += 2) { float ccz = cz + k * (islandTableSize.y * 0.25f); PlanChair chair = new PlanChair(); chair.rect = new PlanRect(cx0, ccz - chairWidth * 0.5f, cx1, ccz + chairWidth * 0.5f); chair.height = chairHeight; chair.pullable = true; chair.pullDirection = new Vector3(side, 0f, 0f); seat.chairs.Add(chair); // 席の前の点(椅子の通路側のふちから少し離れた、通路の上) float inset = SeatApproachInset(w); float spotX = side < 0 ? colX0 - inset : colX1 + inset; seat.spots.Add(new PlanSeatSpot( (side < 0 ? "西" : "東") + (k < 0 ? "南" : "北"), new Vector3(spotX, 0f, ccz))); } } plan.seats.Add(seat); // 1列の中の卓どうしのすき間をふさぐ if (r < islandTablesPerColumn - 1 && islandTableGapZ > 0.0005f) plan.AddBox("IslandGap", BoxStyle.Divider, new PlanRect(colX0, tz1, colX1, tz1 + islandTableGapZ), dividerHeight); } } } } // ---------------- 入口まわり ---------------- void ComposeFront(StorePlan plan, float h, float t) { // ---- ドリンクバー(B4)---- // カウンターは太い通路の西のふちに寄せる。壁卓3つとのあいだは通り道。 // 奥行きは「カウンター+立つ場所+並ぶ点+通路との隙間」で決まり、 // 南の帯に入りきらない分だけ、ここだけ壁を南へ出してくぼみにする。 float dbX0 = DrinkBarWestX; float dbX1 = DrinkBarEastX; float barNorth = DrinkBarNorthZ; float standNorth = DrinkBarStandNorthZ; float queueNorth = DrinkBarQueueNorthZ; float standZ = (barNorth + standNorth) * 0.5f; float queueZ = (standNorth + queueNorth) * 0.5f; plan.AddPlace(PlaceKind.DrinkBar, "DrinkBar", new PlanRect(dbX0, DrinkBarSouthZ, dbX1, barNorth), counterHeight, new Vector3((dbX0 + dbX1) * 0.5f, 0f, standZ), true); // 前に立つ点(機械1台に1つ)。カウンターの長さを等分する int stands = Mathf.Max(0, drinkBarStandCount); for (int i = 0; i < stands; i++) { float x = dbX0 + drinkBarSize.x * (i + 0.5f) / stands; plan.AddPlace(PlaceKind.DrinkBarStand, "DrinkBarStand" + (i + 1).ToString("00"), new PlanRect(0f, 0f, 0f, 0f), 0f, new Vector3(x, 0f, standZ), false); } // 並ぶ点は、立つ場所の後ろに1列つくる。カウンターの東の端から西へ並ぶ。 // 南の細い通路(SouthAisle)には入らない奥行きに収める int queues = Mathf.Max(0, drinkBarQueueCount); for (int i = 0; i < queues; i++) { float x = dbX1 - drinkBarQueuePitch * (i + 0.5f); if (x < dbX0 + 0.05f) break; plan.AddPlace(PlaceKind.DrinkBarQueue, "DrinkBarQueue" + (i + 1).ToString("00"), new PlanRect(0f, 0f, 0f, 0f), 0f, new Vector3(x, 0f, queueZ), false); } // ---- レジ・レジの内側・待合・入口(太い通路の東の帯)---- // // レジ台をはさんで、南が客側・北が店員側。 // 店員側(レジの内側):幅 registerSize.x × 奥行き registerBackDepthZ。 // 西(太い通路=店の奥)からだけ入る。客の並ぶ列や待合の中は通らない // 客側:レジ台の南に並ぶ点。店員側には入れない // (人用の NavMesh でも、PeopleSpec.registerBackArea の区画にして客を入れない) float feX0 = FrontEastWestX; float feX1 = FrontEastEastX; float feZ = WaitingDepth; // レジの台(客側と店員側のさかい) float regX0 = feX0; float regX1 = RegisterEastX; float regZ1 = feZ; float regZ0 = regZ1 - registerSize.y; plan.AddPlace(PlaceKind.Register, "Register", new PlanRect(regX0, regZ0, regX1, regZ1), counterHeight, new Vector3((regX0 + regX1) * 0.5f, 0f, regZ0 - approachGap), true); // 店員側(レジの内側)。北を壁でふさぎ、東はトイレの西の壁が兼ねる。 // 南はレジの台、西だけが開いている(太い通路から入る) PlanRect back = RegisterBackRect; if (!back.IsEmpty) { plan.AddBox("RegisterBackWall_N", BoxStyle.Wall, new PlanRect(back.xMin, back.zMax, back.xMax, back.zMax + t), h); plan.AddPlace(PlaceKind.RegisterBack, "RegisterBack", back, 0f, new Vector3(back.CenterX, 0f, back.CenterZ), false); } // 客が並ぶ点。レジの台の南、東へ順に並べる float regQueueZ = regZ0 - approachGap; for (int i = 0; i < Mathf.Max(0, registerQueueCount); i++) { float x = regX0 + 0.4f + i * registerQueuePitch; if (x > feX1 - 0.25f) break; plan.AddPlace(PlaceKind.RegisterQueue, "RegisterQueue" + (i + 1).ToString("00"), new PlanRect(0f, 0f, 0f, 0f), 0f, new Vector3(x, 0f, regQueueZ), false); } // 待合(レジの台より東。客側) plan.AddPlace(PlaceKind.Waiting, "Waiting", new PlanRect(regX1, 0f, feX1, feZ), 0f, new Vector3((regX1 + feX1) * 0.5f, 0f, feZ * 0.5f), false); } // ---------------- 報告(Build Store が出す)---------------- public override string FrontFitReport() { int nNorth = NorthWallTableCount; int nSouth = SouthWallTableCount; float gapNorth = WallTableGap(true); float gapSouth = WallTableGap(false); float southRowEast = IslandWestX + nSouth * wallTableSize.x + (nSouth > 1 ? (nSouth - 1) * gapSouth : 0f); float barRoom = MainAisleWestX - southRowEast; float personGap = navAgentRadius * 2f; float waitGross = (FrontEastEastX - RegisterEastX) * WaitingDepth; float waitNet = waitGross; // レジの台と店員側は待合の外に出したので、引かない string s = ""; s += "外寸(建物だけ): " + N(OuterEastX) + " × " + N(OuterNorthZ) + " m\n"; s += " 南の帯の奥行き: " + N(FrontDepthZ) + " m(椅子 " + N(chairDepth) + " + 卓 " + N(wallTableSize.y) + " + ベンチ " + N(benchDepth) + ")\n"; s += " 北のふち: 帯の足し算 " + N(NorthRowOuterZ) + " m / ブースの列 " + N(BoothColumnNorthZ) + " m(ブース " + wallBoothCount + " × " + N(BoothUnitZ) + " m)→ 長いほうを採る"; if (OuterNorthZ - NorthRowOuterZ > 0.0005f) s += "\n 北の壁ぞいの卓の後ろ " + N(OuterNorthZ - NorthRowOuterZ) + " m は壁でふさいだ(NorthRowBackFiller)"; s += "\n"; s += "壁ぞいの2人席: 卓 " + N(wallTableSize.x) + " × " + N(wallTableSize.y) + " m\n"; s += " 上の列: " + nNorth + " つ / 使える幅 " + N(NorthRowSpanX) + " m / すき間 " + N(gapNorth) + " m\n"; s += " 下の列: " + nSouth + " つ / 使える幅 " + N(SouthRowSpanX) + " m(ドリンクバーの " + N(drinkBarSize.x) + " m を引いた残り)/ すき間 " + N(gapSouth) + " m\n"; s += " 卓の数の決め方: " + (wallTableCountFromNarrowestAisle ? "いちばん狭い通路 " + N(MinAisleWidth) + " m のときに入る数にそろえた(条件どうしを比べるため)" : "いまの通路の幅で入るだけ並べた(幅ごとに数が変わる)") + "\n"; s += " すき間と人の通れる幅: いちばん狭いすき間 " + N(Mathf.Min(gapNorth, gapSouth)) + " m / 焼いた NavMesh の通行幅 " + N(personGap) + " m(navAgentRadius × 2)→ " + (Mathf.Min(gapNorth, gapSouth) >= personGap + 0.0005f ? "壁側の席に入れる" : "入れない ← wallTableGapX を広げる") + "\n"; s += "ドリンクバー: カウンター " + N(drinkBarSize.x) + " × " + N(drinkBarSize.y) + " m を x " + N(DrinkBarWestX) + ".." + N(DrinkBarEastX) + " に置いた(下の列の東の残り " + N(barRoom) + " m)" + (barRoom + 0.0005f >= drinkBarSize.x ? "" : " ← 入りきらない") + "\n"; s += " 奥行き: カウンター " + N(drinkBarSize.y) + " + 立つ場所 " + N(drinkBarStandDepthZ) + " + 並ぶ点の列 " + N(drinkBarQueueDepthZ) + " + 通路との隙間 " + N(drinkBarAisleClearZ) + " = " + N(DrinkBarNeedZ) + " m\n"; s += " くぼみ(アルコーブ): 南へ " + N(DrinkBarAlcoveZ) + " m(" + N(drinkBarSize.x) + " m 幅ぶんだけ壁を外へ出した)\n"; s += " 立つ点 " + drinkBarStandCount + " つ(z " + N(standZOf()) + ")/ 並ぶ点 " + drinkBarQueueCount + " つ(z " + N(queueZOf()) + ")\n"; s += " 並ぶ点の北のふち " + N(DrinkBarQueueNorthZ) + " m < 南の細い通路の南のふち " + N(SouthRowNorthZ) + " m → " + (DrinkBarQueueNorthZ <= SouthRowNorthZ + 0.0005f ? "通路と重ならない" : "通路に重なる ← 直す必要あり") + "\n"; s += "待合: x " + N(RegisterEastX) + ".." + N(FrontEastEastX) + " / 奥行き " + N(WaitingDepth) + " m → " + N(waitGross) + " m^2(レジの台と店員側は含まない)\n"; s += " 必要な広さ: " + waitingStandCount + " 人 × " + N(waitingStandAreaM2) + " m^2 = " + N(WaitingNeedAreaM2) + " m^2 → " + (waitNet + 0.0005f >= WaitingNeedAreaM2 ? "足りている" : "足りない ← 直す必要あり") + "\n"; PlanRect back = RegisterBackRect; s += "レジ: 台 " + N(registerSize.x) + " × " + N(registerSize.y) + " m(x " + N(MainAisleEastX) + ".." + N(RegisterEastX) + ")。" + "台をはさんで南が客側・北が店員側\n"; s += " 店員側(レジの内側): " + N(back.SizeX) + " × " + N(back.SizeZ) + " m(" + back.ToString() + ")/ スタッフの立つ点 (" + N(back.CenterX) + ", " + N(back.CenterZ) + ")\n"; s += " 入口は西(太い通路 x " + N(MainAisleEastX) + ")だけ、幅 " + N(RegisterBackDepth) + " m。北は壁、東はトイレの西の壁、南はレジの台 → 客の列や待合の中は通らない\n"; s += " 焼いた面で残る入口の幅の見込み: 人用 " + N(RegisterBackDepth - 0.4f) + " m / ロボット用 " + N(RegisterBackDepth - navAgentRadius * 2f) + " m(必要 " + N(registerBackMinOpenZ) + " m 以上)\n"; s += " 客の並ぶ点 " + registerQueueCount + " つ(レジ台の南, z " + N(WaitingDepth - registerSize.y - approachGap) + ")。" + "店員側は NavMesh の区画を分けてあるので、客は入れない\n"; s += "入口: 中心 x " + N(EntranceCenterX()) + " / 幅 " + N(entranceWidthX) + " m(太い通路の東。トイレは z " + N(ToiletSouthZ) + ".." + N(ToiletNorthZ) + " へ北寄せ)"; return s; } public override string RobotStandbyReport() { StorePlan plan = NewPlan(); if (plan == null) return ""; System.Collections.Generic.List pts = plan.PointsOf(PlaceKind.RobotStandby); if (pts.Count == 0) return "待機の点がありません(robotStandbyCount = " + robotStandbyCount + ")"; float r = navAgentRadius; // ロボットの半径に合わせた値 Vector3 pass = plan.PointOf(PlaceKind.FoodPass, Vector3.zero); Vector3 pantry = plan.PointOf(PlaceKind.Pantry, Vector3.zero); Vector3 ret = plan.PointOf(PlaceKind.DishReturn, Vector3.zero); string s = "太い通路: x " + N(MainAisleWestX) + ".." + N(MainAisleEastX) + "(幅 " + N(mainAisleWidth) + " m)/ ロボットの半径 " + N(r) + " m\n"; float minPitch = float.MaxValue; float minService = float.MaxValue; float minClear = float.MaxValue; for (int i = 0; i < pts.Count; i++) { Vector3 p = pts[i]; float westClear = (p.x - r) - MainAisleWestX; // 西側に残る通り道 float eastGap = MainAisleEastX - (p.x + r); // 東のカウンター面までの空き float dPass = Dist2D(p, pass); float dPantry = Dist2D(p, pantry); float dRet = Dist2D(p, ret); if (westClear < minClear) minClear = westClear; float svc = Mathf.Min(dPass, Mathf.Min(dPantry, dRet)); if (svc < minService) minService = svc; if (i > 0) { float d = Dist2D(p, pts[i - 1]); if (d < minPitch) minPitch = d; } s += " 待機" + (i + 1).ToString("00") + ": (" + N(p.x) + ", " + N(p.z) + ")" + " / 西に残る通り道 " + N(westClear) + " m / 東のカウンター面まで " + N(eastGap) + " m" + " / 受け渡し口の前の点まで " + N(dPass) + " m・パントリー " + N(dPantry) + " m・返却口 " + N(dRet) + " m\n"; } if (pts.Count >= 2) s += " 点どうしのいちばん近い距離: " + N(minPitch) + " m → " + (minPitch >= r * 2f + 0.0005f ? "重ならない(直径 " + N(r * 2f) + " m)" : "重なる ← 直す必要あり") + "\n"; else s += " 点は1つだけなので、重なりの確かめは要らない\n"; s += " 西に残る通り道のいちばん狭いところ: " + N(minClear) + " m → " + (minClear >= robotStandbyMinClearX - 0.0005f ? "太い通路をふさがない(必要 " + N(robotStandbyMinClearX) + " m 以上)" : "ふさぐ ← 直す必要あり(必要 " + N(robotStandbyMinClearX) + " m 以上)") + "\n"; s += " スタッフが立つ点(受け渡し口・パントリー・返却口の前。どれも通路の真ん中)までの" + "いちばん近い距離: " + N(minService) + " m → " + (minService >= r * 2f + 0.0005f ? "重ならない" : "重なる ← 直す必要あり") + "\n"; // 手の空いたスタッフが待つ点 System.Collections.Generic.List st = plan.PointsOf(PlaceKind.StaffStandby); float pr = 0.2f; // 人の半径(PeopleSpec の仮の値に合わせる) s += "スタッフの待つ点: " + st.Count + " つ"; if (st.Count == 0) return s + "(無し ← staffStandbyCount を見る)"; float stMinPitch = float.MaxValue; float stMinClear = float.MaxValue; for (int i = 0; i < st.Count; i++) { float west = (st[i].x - pr) - MainAisleWestX; float east = MainAisleEastX - (st[i].x + pr); if (Mathf.Min(west, east) < stMinClear) stMinClear = Mathf.Min(west, east); if (i > 0) stMinPitch = Mathf.Min(stMinPitch, Dist2D(st[i], st[i - 1])); s += "\n 待つ" + (i + 1).ToString("00") + ": (" + N(st[i].x) + ", " + N(st[i].z) + ")" + " / 太い通路の西のふちまで " + N(west) + " m・東のふちまで " + N(east) + " m"; } s += "\n 受け渡し口の窓口の北のふち z " + N(OuterNorthZ - passFromNorthZ + passWindowLengthZ * 0.5f) + " より北 → ロボットの行き先(受け渡し口 " + N(OuterNorthZ - passFromNorthZ) + " ・パントリー・返却口・待機場所)はすべて南なので、" + "通り道をふさがない"; if (st.Count >= 2) s += "\n 点どうしのいちばん近い距離: " + N(stMinPitch) + " m → " + (stMinPitch >= pr * 2f + 0.0005f ? "重ならない(人の直径 " + N(pr * 2f) + " m)" : "重なる ← 直す必要あり"); s += "\n 待っている人の左右に残る幅のいちばん狭いところ: " + N(stMinClear) + " m" + "(太い通路 " + N(mainAisleWidth) + " m のうち)"; return s; } static float Dist2D(Vector3 a, Vector3 b) { float dx = a.x - b.x, dz = a.z - b.z; return Mathf.Sqrt(dx * dx + dz * dz); } float standZOf() { return (DrinkBarNorthZ + DrinkBarStandNorthZ) * 0.5f; } float queueZOf() { return (DrinkBarStandNorthZ + DrinkBarQueueNorthZ) * 0.5f; } static string N(float v) { return v.ToString("0.##", System.Globalization.CultureInfo.InvariantCulture); } } }