tweak: 입고 동선 단축 (박스 z=-1 / 슬롯 z=1)

플레이어 스폰 양옆으로 박스·슬롯을 바짝 배치해 왕복 거리 축소.
setup 재실행 시 기존 오브젝트 위치도 갱신되도록 변경.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
jklee
2026-06-14 20:20:26 +09:00
parent f230b438ed
commit 298e35c50b
2 changed files with 28 additions and 16 deletions
+14 -7
View File
@@ -39,21 +39,28 @@ namespace SinoWms.EditorTools
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
string objName = $"Box_{i + 1}"; string objName = $"Box_{i + 1}";
if (container.transform.Find(objName) != null) continue; var existing = container.transform.Find(objName);
var box = GameObject.CreatePrimitive(PrimitiveType.Cube); GameObject box;
if (existing != null)
{
box = existing.gameObject;
}
else
{
box = GameObject.CreatePrimitive(PrimitiveType.Cube);
box.name = objName; box.name = objName;
box.transform.SetParent(container.transform, false); box.transform.SetParent(container.transform, false);
box.transform.localPosition = new Vector3(-3f + i * 2f, 0.5f, -20f);
box.transform.localScale = Vector3.one; box.transform.localScale = Vector3.one;
box.GetComponent<Renderer>().sharedMaterial = MakeMaterial(colors[i]); box.GetComponent<Renderer>().sharedMaterial = MakeMaterial(colors[i]);
box.AddComponent<Rigidbody>().mass = 1f;
var rb = box.AddComponent<Rigidbody>();
rb.mass = 1f;
box.AddComponent<Carryable>().displayName = names[i]; box.AddComponent<Carryable>().displayName = names[i];
} }
// 위치는 항상 갱신(동선 단축 — 플레이어 스폰 바로 남쪽)
box.transform.localPosition = new Vector3(-3f + i * 2f, 0.5f, -1f);
}
EditorSceneManager.MarkSceneDirty(player.scene); EditorSceneManager.MarkSceneDirty(player.scene);
Selection.activeGameObject = player; Selection.activeGameObject = player;
Debug.Log("[PickupDemoSetup] 완료. Play 후 박스에 다가가 E키로 집고 놓아 보세요."); Debug.Log("[PickupDemoSetup] 완료. Play 후 박스에 다가가 E키로 집고 놓아 보세요.");
+10 -5
View File
@@ -14,10 +14,10 @@ namespace SinoWms.EditorTools
// 슬롯 위치와 기대 품목 (PickupDemoSetup의 박스 이름과 일치시켜 정답 구성) // 슬롯 위치와 기대 품목 (PickupDemoSetup의 박스 이름과 일치시켜 정답 구성)
private static readonly (Vector3 pos, string expected)[] Slots = private static readonly (Vector3 pos, string expected)[] Slots =
{ {
(new Vector3(-6f, 0.03f, 8f), "박스 A (생수)"), (new Vector3(-3f, 0.03f, 1f), "박스 A (생수)"),
(new Vector3(-2f, 0.03f, 8f), "박스 B (우유)"), (new Vector3(-1f, 0.03f, 1f), "박스 B (우유)"),
(new Vector3(2f, 0.03f, 8f), "박스 C (라면)"), (new Vector3(1f, 0.03f, 1f), "박스 C (라면)"),
(new Vector3(6f, 0.03f, 8f), "박스 D (잡화)"), (new Vector3(3f, 0.03f, 1f), "박스 D (잡화)"),
}; };
[MenuItem("SinoWMS/Setup Slots")] [MenuItem("SinoWMS/Setup Slots")]
@@ -28,7 +28,12 @@ namespace SinoWms.EditorTools
for (int i = 0; i < Slots.Length; i++) for (int i = 0; i < Slots.Length; i++)
{ {
string slotName = $"Slot_{i + 1}"; string slotName = $"Slot_{i + 1}";
if (container.transform.Find(slotName) != null) continue; var existing = container.transform.Find(slotName);
if (existing != null)
{
existing.localPosition = Slots[i].pos; // 위치만 갱신
continue;
}
var slotGo = new GameObject(slotName); var slotGo = new GameObject(slotName);
slotGo.transform.SetParent(container.transform, false); slotGo.transform.SetParent(container.transform, false);