diff --git a/Assets/0.SCENE/MainGame.unity b/Assets/0.SCENE/MainGame.unity index 9faf0520..ead0ba4e 100644 --- a/Assets/0.SCENE/MainGame.unity +++ b/Assets/0.SCENE/MainGame.unity @@ -9131,7 +9131,7 @@ Transform: m_GameObject: {fileID: 85056388} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 20.840582, y: 7.99, z: 20.65} + m_LocalPosition: {x: 36.23, y: 7.99, z: 20.65} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -163981,6 +163981,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 172.153 objectReference: {fileID: 0} + - target: {fileID: 2669107996035270001, guid: 9f51c4433e5c81644807e9e547b7826c, type: 3} + propertyPath: m_ConstrainProportionsScale + value: 1 + objectReference: {fileID: 0} - target: {fileID: 4085536598674672635, guid: 9f51c4433e5c81644807e9e547b7826c, type: 3} propertyPath: m_Size.x value: 0.003 diff --git a/Assets/Scripts/Level_Scripts/LevelUpUIManager.cs b/Assets/Scripts/Level_Scripts/LevelUpUIManager.cs index 96119ee0..a46b553d 100644 --- a/Assets/Scripts/Level_Scripts/LevelUpUIManager.cs +++ b/Assets/Scripts/Level_Scripts/LevelUpUIManager.cs @@ -35,38 +35,37 @@ public class LevelUpUIManager : MonoBehaviour Time.timeScale = 0f; _selectedCardUI = null; - if (applyButton != null) applyButton.interactable = false; // 시작 땐 버튼 비활성 + if (applyButton != null) applyButton.interactable = false; foreach (Transform child in cardParent) Destroy(child.gameObject); int slotCount = 2; - // ⭐ [에러 해결] selectedCards를 여기서 확실히 선언합니다! + /* ========================= + * 1️⃣ CardData 선택 (중복 없음) + * ========================= */ List selectedCards = new List(); + List tempDataPool = new List(cardPool); - if (cardPool.Count >= slotCount) - { - List tempPool = new List(cardPool); - for (int i = 0; i < slotCount; i++) - { - int idx = Random.Range(0, tempPool.Count); - selectedCards.Add(tempPool[idx]); - tempPool.RemoveAt(idx); - } - } - else // 카드 부족 시 순환 - { - for (int i = 0; i < slotCount; i++) - selectedCards.Add(cardPool[i % cardPool.Count]); - } - - // 카드 생성 및 셋업 for (int i = 0; i < slotCount; i++) { - // 프리팹 랜덤 선택 후 생성 - CardUI ui = Instantiate(cardPrefabs[Random.Range(0, cardPrefabs.Length)], cardParent); - ui.Setup(selectedCards[i], this); // ⭐ 이제 selectedCards 에러가 뜨지 않습니다! + int idx = Random.Range(0, tempDataPool.Count); + selectedCards.Add(tempDataPool[idx]); + tempDataPool.RemoveAt(idx); + } + + /* ========================= + * 2️⃣ CardUI 프리팹 선택 (중복 없음) + * ========================= */ + List tempPrefabs = new List(cardPrefabs); + + for (int i = 0; i < slotCount; i++) + { + int idx = Random.Range(0, tempPrefabs.Count); + CardUI ui = Instantiate(tempPrefabs[idx], cardParent); + ui.Setup(selectedCards[i], this); + tempPrefabs.RemoveAt(idx); } }