tweak: 입고 동선 단축 (박스 z=-1 / 슬롯 z=1)
플레이어 스폰 양옆으로 박스·슬롯을 바짝 배치해 왕복 거리 축소. setup 재실행 시 기존 오브젝트 위치도 갱신되도록 변경. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -39,21 +39,28 @@ namespace SinoWms.EditorTools
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
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.transform.SetParent(container.transform, false);
|
||||
box.transform.localPosition = new Vector3(-3f + i * 2f, 0.5f, -20f);
|
||||
box.transform.localScale = Vector3.one;
|
||||
box.GetComponent<Renderer>().sharedMaterial = MakeMaterial(colors[i]);
|
||||
|
||||
var rb = box.AddComponent<Rigidbody>();
|
||||
rb.mass = 1f;
|
||||
|
||||
box.AddComponent<Rigidbody>().mass = 1f;
|
||||
box.AddComponent<Carryable>().displayName = names[i];
|
||||
}
|
||||
|
||||
// 위치는 항상 갱신(동선 단축 — 플레이어 스폰 바로 남쪽)
|
||||
box.transform.localPosition = new Vector3(-3f + i * 2f, 0.5f, -1f);
|
||||
}
|
||||
|
||||
EditorSceneManager.MarkSceneDirty(player.scene);
|
||||
Selection.activeGameObject = player;
|
||||
Debug.Log("[PickupDemoSetup] 완료. Play 후 박스에 다가가 E키로 집고 놓아 보세요.");
|
||||
|
||||
@@ -14,10 +14,10 @@ namespace SinoWms.EditorTools
|
||||
// 슬롯 위치와 기대 품목 (PickupDemoSetup의 박스 이름과 일치시켜 정답 구성)
|
||||
private static readonly (Vector3 pos, string expected)[] Slots =
|
||||
{
|
||||
(new Vector3(-6f, 0.03f, 8f), "박스 A (생수)"),
|
||||
(new Vector3(-2f, 0.03f, 8f), "박스 B (우유)"),
|
||||
(new Vector3(2f, 0.03f, 8f), "박스 C (라면)"),
|
||||
(new Vector3(6f, 0.03f, 8f), "박스 D (잡화)"),
|
||||
(new Vector3(-3f, 0.03f, 1f), "박스 A (생수)"),
|
||||
(new Vector3(-1f, 0.03f, 1f), "박스 B (우유)"),
|
||||
(new Vector3(1f, 0.03f, 1f), "박스 C (라면)"),
|
||||
(new Vector3(3f, 0.03f, 1f), "박스 D (잡화)"),
|
||||
};
|
||||
|
||||
[MenuItem("SinoWMS/Setup Slots")]
|
||||
@@ -28,7 +28,12 @@ namespace SinoWms.EditorTools
|
||||
for (int i = 0; i < Slots.Length; i++)
|
||||
{
|
||||
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);
|
||||
slotGo.transform.SetParent(container.transform, false);
|
||||
|
||||
Reference in New Issue
Block a user