feat: 집기/놓기 상호작용 (게임 핵심 루프)

- Carryable: 집을 수 있는 물건 표시
- PickupController: 범위 내 박스를 E키로 집고/놓기 + 화면 힌트
- PickupDemoSetup: 플레이어에 PickupController 부착 + 입고 박스 4개 스폰

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
jklee
2026-06-14 20:05:50 +09:00
parent f5ae70b0aa
commit f8577c5f7d
7 changed files with 196 additions and 0 deletions
+68
View File
@@ -0,0 +1,68 @@
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using SinoWms.Gameplay;
using SinoWms.Player;
namespace SinoWms.EditorTools
{
/// <summary>
/// 집기/놓기 데모 구성: 플레이어에 PickupController 추가 + 입고 박스 스폰.
/// 메뉴 <b>SinoWMS/Setup Pickup Demo</b>. Play 후 박스에 다가가 E키로 집고 놓는다.
/// </summary>
public static class PickupDemoSetup
{
[MenuItem("SinoWMS/Setup Pickup Demo")]
public static void Setup()
{
var player = GameObject.Find("Player");
if (player == null)
{
Debug.LogError("[PickupDemoSetup] Player가 없습니다. 먼저 'Setup Playground Scene'을 실행하세요.");
return;
}
if (player.GetComponent<PickupController>() == null)
player.AddComponent<PickupController>();
var container = GameObject.Find("InboundBoxes") ?? new GameObject("InboundBoxes");
// 입고 대기 박스 4개 (남쪽 통로 근처에 배치)
var colors = new[]
{
new Color(0.75f, 0.55f, 0.35f),
new Color(0.70f, 0.50f, 0.30f),
new Color(0.80f, 0.60f, 0.40f),
new Color(0.65f, 0.45f, 0.28f),
};
string[] names = { "박스 A (생수)", "박스 B (우유)", "박스 C (라면)", "박스 D (잡화)" };
for (int i = 0; i < 4; i++)
{
string objName = $"Box_{i + 1}";
if (container.transform.Find(objName) != null) continue;
var 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<Carryable>().displayName = names[i];
}
EditorSceneManager.MarkSceneDirty(player.scene);
Selection.activeGameObject = player;
Debug.Log("[PickupDemoSetup] 완료. Play 후 박스에 다가가 E키로 집고 놓아 보세요.");
}
private static Material MakeMaterial(Color color)
{
var shader = Shader.Find("Universal Render Pipeline/Lit") ?? Shader.Find("Standard");
return new Material(shader) { color = color };
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 10eba722501bf4dcaa1d33cc90d763b1