카드 중복

This commit is contained in:
배준수_playm 2026-02-02 19:51:54 +09:00
parent 1f33b11f66
commit 81b694b6af
2 changed files with 26 additions and 23 deletions

View File

@ -9131,7 +9131,7 @@ Transform:
m_GameObject: {fileID: 85056388} m_GameObject: {fileID: 85056388}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 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_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@ -163981,6 +163981,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 172.153 value: 172.153
objectReference: {fileID: 0} 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} - target: {fileID: 4085536598674672635, guid: 9f51c4433e5c81644807e9e547b7826c, type: 3}
propertyPath: m_Size.x propertyPath: m_Size.x
value: 0.003 value: 0.003

View File

@ -35,38 +35,37 @@ public class LevelUpUIManager : MonoBehaviour
Time.timeScale = 0f; Time.timeScale = 0f;
_selectedCardUI = null; _selectedCardUI = null;
if (applyButton != null) applyButton.interactable = false; // 시작 땐 버튼 비활성 if (applyButton != null) applyButton.interactable = false;
foreach (Transform child in cardParent) foreach (Transform child in cardParent)
Destroy(child.gameObject); Destroy(child.gameObject);
int slotCount = 2; int slotCount = 2;
// ⭐ [에러 해결] selectedCards를 여기서 확실히 선언합니다! /* =========================
* 1 CardData ( )
* ========================= */
List<CardData> selectedCards = new List<CardData>(); List<CardData> selectedCards = new List<CardData>();
List<CardData> tempDataPool = new List<CardData>(cardPool);
if (cardPool.Count >= slotCount)
{
List<CardData> tempPool = new List<CardData>(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++) for (int i = 0; i < slotCount; i++)
{ {
// 프리팹 랜덤 선택 후 생성 int idx = Random.Range(0, tempDataPool.Count);
CardUI ui = Instantiate(cardPrefabs[Random.Range(0, cardPrefabs.Length)], cardParent); selectedCards.Add(tempDataPool[idx]);
ui.Setup(selectedCards[i], this); // ⭐ 이제 selectedCards 에러가 뜨지 않습니다! tempDataPool.RemoveAt(idx);
}
/* =========================
* 2 CardUI ( )
* ========================= */
List<CardUI> tempPrefabs = new List<CardUI>(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);
} }
} }