Card display

This commit is contained in:
2025-07-29 00:11:48 +02:00
parent 058170bbf9
commit 352a3a8de6

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System; using System;
using UnityEngine.Rendering;
public class CardManager : MonoBehaviour public class CardManager : MonoBehaviour
{ {
@@ -63,16 +64,15 @@ public class CardManager : MonoBehaviour
Debug.Log($"Available cards: {string.Join(", ", availableCards.Select(x => x.Skill))}"); Debug.Log($"Available cards: {string.Join(", ", availableCards.Select(x => x.Skill))}");
Debug.Log($"Unlocked skills: {string.Join(", ", unlockedSkills)}"); Debug.Log($"Unlocked skills: {string.Join(", ", unlockedSkills)}");
int xOffset = -800;
if (availableCards.Count < 3) float step = Screen.width / shuffled.Count;
{ float pos = step - Screen.width / (2*shuffled.Count);
xOffset = -400;
}
foreach (var cardUI in shuffled) foreach (var cardUI in shuffled)
{ {
var newCard = Instantiate(cardUI.gameObject, cardsParent.position + new Vector3(xOffset, 0, 0), Quaternion.identity, cardsParent); var newCard = Instantiate(cardUI.gameObject, new Vector3(pos, Screen.height/2, 0), Quaternion.identity, cardsParent);
xOffset += 800; pos += step;
} }
} }